@@ -37,7 +37,7 @@ namespace af
3737 const array *parent;
3838 bool isRef;
3939 std::vector<seq> s;
40- void getSeq (af_seq* afs);
40+ void getSeq (af_seq* afs) const ;
4141 array (af_array in, const array *par, seq *seqs);
4242 void set (af_array tmp);
4343 void set (af_array tmp) const ;
@@ -206,103 +206,144 @@ namespace af
206206 array T () const ;
207207 array H () const ;
208208
209- array& operator = (const array &a); // /< array assignment
210- array& operator = (const double &value);
211- array& operator = (const cfloat &value);
212- array& operator = (const cdouble &value);
213-
214- #define SELF (op ) \
215- array& operator op (const array &a); \
216- array& operator op (const double &a); \
217- array& operator op (const cdouble &a); \
218- array& operator op (const cfloat &a); \
219-
220- SELF (+=)
221- SELF (-=)
222- SELF (*=)
223- SELF (/=)
224-
225-
226- #define BIN (op ) \
227- array operator op (const array&) const ; \
228- array operator op (const double &) const ; \
229- array operator op (const cfloat&) const ; \
230- array operator op (const cdouble&) const ; \
231- AFAPI friend array operator op (const double &, const array&); \
232- AFAPI friend array operator op (const cfloat&, const array&); \
233- AFAPI friend array operator op (const cdouble&, const array&); \
234-
235- BIN (+)
236- BIN (-)
237- BIN (*)
238- BIN (/)
239-
240- #define LOGIC (op ) \
241- array operator op (const array&) const ; \
242- array operator op (const bool &) const ; \
243- array operator op (const int &) const ; \
244- array operator op (const double &) const ; \
245- array operator op (const cfloat&) const ; \
246- array operator op (const cdouble&) const ; \
247- AFAPI friend array operator op (const bool &, const array&); \
248- AFAPI friend array operator op (const int &, const array&); \
249- AFAPI friend array operator op (const double &, const array&); \
250- AFAPI friend array operator op (const cfloat&, const array&); \
251- AFAPI friend array operator op (const cdouble&, const array&); \
252-
253- LOGIC (==)
254- LOGIC (!=)
255- LOGIC (< )
256- LOGIC (<=)
257- LOGIC (> )
258- LOGIC (>=)
259- LOGIC (&&)
260- LOGIC (||)
261- LOGIC (%)
262- LOGIC (&)
263- LOGIC (|)
264- LOGIC (^)
265- LOGIC (<<)
266- LOGIC (>>)
267-
268- #undef SELF
269- #undef BIN
270- #undef LOGIC
271-
272- array operator -() const ;
209+ #define ASSIGN (OP ) \
210+ array& operator OP (const array &a); \
211+ array& operator OP (const double &a); \
212+ array& operator OP (const cdouble &a); \
213+ array& operator OP (const cfloat &a); \
214+ array& operator OP (const float &a); \
215+ array& operator OP (const int &a); \
216+ array& operator OP (const unsigned &a); \
217+ array& operator OP (const bool &a); \
218+ array& operator OP (const char &a); \
219+ array& operator OP (const unsigned char &a); \
220+ array& operator OP (const long &a); \
221+ array& operator OP (const unsigned long &a); \
222+ array& operator OP (const long long &a); \
223+ array& operator OP (const unsigned long long &a); \
224+
225+ ASSIGN (= )
226+ ASSIGN (+=)
227+ ASSIGN (-=)
228+ ASSIGN (*=)
229+ ASSIGN (/=)
230+
231+ #undef ASSIGN
232+
233+ #define OPERATOR (op ) \
234+ array operator op (const array &a) const ; \
235+ array operator op (const double &a) const ; \
236+ array operator op (const cdouble &a) const ; \
237+ array operator op (const cfloat &a) const ; \
238+ array operator op (const float &a) const ; \
239+ array operator op (const int &a) const ; \
240+ array operator op (const unsigned &a) const ; \
241+ array operator op (const bool &a) const ; \
242+ array operator op (const char &a) const ; \
243+ array operator op (const unsigned char &a) const ; \
244+ array operator op (const long &a) const ; \
245+ array operator op (const unsigned long &a) const ; \
246+ array operator op (const long long &a) const ; \
247+ array operator op (const unsigned long long &a) const ; \
248+
249+ OPERATOR (+ )
250+ OPERATOR (- )
251+ OPERATOR (* )
252+ OPERATOR (/ )
253+ OPERATOR (==)
254+ OPERATOR (!=)
255+ OPERATOR (< )
256+ OPERATOR (<=)
257+ OPERATOR (> )
258+ OPERATOR (>=)
259+ OPERATOR (&&)
260+ OPERATOR (||)
261+ OPERATOR (% )
262+ OPERATOR (& )
263+ OPERATOR (| )
264+ OPERATOR (^ )
265+ OPERATOR (<<)
266+ OPERATOR (>>)
267+
268+ #undef OPERATOR
269+
270+ #define FRIEND_OP (op ) \
271+ AFAPI friend array operator op (const bool &, const array&); \
272+ AFAPI friend array operator op (const int &, const array&); \
273+ AFAPI friend array operator op (const unsigned &, const array&); \
274+ AFAPI friend array operator op (const char &, const array&); \
275+ AFAPI friend array operator op (const unsigned char &, const array&); \
276+ AFAPI friend array operator op (const long &, const array&); \
277+ AFAPI friend array operator op (const unsigned long &, const array&); \
278+ AFAPI friend array operator op (const long long &, const array&); \
279+ AFAPI friend array operator op (const unsigned long long &, const array&); \
280+ AFAPI friend array operator op (const double &, const array&); \
281+ AFAPI friend array operator op (const float &, const array&); \
282+ AFAPI friend array operator op (const cfloat&, const array&); \
283+ AFAPI friend array operator op (const cdouble&, const array&); \
284+
285+ FRIEND_OP (+ )
286+ FRIEND_OP (- )
287+ FRIEND_OP (* )
288+ FRIEND_OP (/ )
289+ FRIEND_OP (==)
290+ FRIEND_OP (!=)
291+ FRIEND_OP (< )
292+ FRIEND_OP (<=)
293+ FRIEND_OP (> )
294+ FRIEND_OP (>=)
295+ FRIEND_OP (&&)
296+ FRIEND_OP (||)
297+ FRIEND_OP (% )
298+ FRIEND_OP (& )
299+ FRIEND_OP (| )
300+ FRIEND_OP (^ )
301+ FRIEND_OP (<<)
302+ FRIEND_OP (>>)
303+
304+ #undef FRIEND_OP
305+
306+ array operator -() const ;
273307 array operator !() const ;
274308 };
275309 // end of class array
276310
277- #define BIN (op ) \
278- AFAPI array operator op (const double &, const array&); \
279- AFAPI array operator op (const cfloat&, const array&); \
280- AFAPI array operator op (const cdouble&, const array&); \
281-
282- BIN (+)
283- BIN (-)
284- BIN (*)
285- BIN (/)
286-
287- #define LOGIC (op ) \
288- AFAPI array operator op (const bool &, const array&); \
289- AFAPI array operator op (const int &, const array&); \
290- AFAPI array operator op (const double &, const array&); \
291- AFAPI array operator op (const cfloat&, const array&); \
292- AFAPI array operator op (const cdouble&, const array&); \
293-
294- LOGIC (==)
295- LOGIC (!=)
296- LOGIC (< )
297- LOGIC (<=)
298- LOGIC (> )
299- LOGIC (>=)
300- LOGIC (&&)
301- LOGIC (||)
302-
303- #undef SELF
304- #undef BIN
305- #undef LOGIC
311+ #define BIN_OP (op ) \
312+ AFAPI array operator op (const bool &, const array&); \
313+ AFAPI array operator op (const int &, const array&); \
314+ AFAPI array operator op (const unsigned &, const array&); \
315+ AFAPI array operator op (const char &, const array&); \
316+ AFAPI array operator op (const unsigned char &, const array&); \
317+ AFAPI array operator op (const long &, const array&); \
318+ AFAPI array operator op (const unsigned long &, const array&); \
319+ AFAPI array operator op (const long long &, const array&); \
320+ AFAPI array operator op (const unsigned long long &, const array&); \
321+ AFAPI array operator op (const double &, const array&); \
322+ AFAPI array operator op (const float &, const array&); \
323+ AFAPI array operator op (const cfloat&, const array&); \
324+ AFAPI array operator op (const cdouble&, const array&); \
325+
326+ BIN_OP (+ );
327+ BIN_OP (- );
328+ BIN_OP (* );
329+ BIN_OP (/ );
330+ BIN_OP (==);
331+ BIN_OP (!=);
332+ BIN_OP (< );
333+ BIN_OP (<=);
334+ BIN_OP (> );
335+ BIN_OP (>=);
336+ BIN_OP (&&);
337+ BIN_OP (||);
338+ BIN_OP (% );
339+ BIN_OP (& );
340+ BIN_OP (| );
341+ BIN_OP (^ );
342+ BIN_OP (<<);
343+ BIN_OP (>>);
344+
345+ #undef BIN_OP
346+
306347
307348 // / Evaluate an expression (nonblocking).
308349 inline array &eval (array &a) { a.eval (); return a; }
0 commit comments