39 #ifndef AFF_OPERATORS_CLASS 40 #error "never ever inlcude this from your code!" 43 #ifndef AFF_OPERATORS_CONSTCLASS 44 #error "definition of container of const is missing!" 70 #define AFF_OPERATORS_TEMPAR T 71 #define AFF_OPERATORS_CONT AFF_OPERATORS_CLASS< AFF_OPERATORS_TEMPAR > 72 #define AFF_OPERATORS_CONSTCONT AFF_OPERATORS_CONSTCLASS< AFF_OPERATORS_TEMPAR > 80 #define AFF_OPERATORS_UNOP( CONT, OP ) \ 81 template<class AFF_OPERATORS_TEMPAR > \ 82 const CONT& operator OP ## =(const CONT& container, \ 83 typename CONT::Tconst_reference value) \ 85 for (aff::Iterator< CONT > i(container); i.valid(); ++i) \ 86 { (*i) OP ## = value; } \ 95 #define AFF_OPERATORS_BINOP( RETCONT, INCONT, OP ) \ 96 template<class AFF_OPERATORS_TEMPAR > \ 97 RETCONT operator OP(const INCONT& container, \ 98 typename INCONT::Tconst_reference value) \ 100 RETCONT retval(container.shape()); \ 101 aff::Browser< typename INCONT::Tcontainer > i(container); \ 102 aff::Iterator< typename RETCONT::Tcontainer > o(retval); \ 103 while ( i.valid() && o. valid() ) \ 104 { (*o) = (*i) OP value; ++o; ++i; } \ 107 template<class AFF_OPERATORS_TEMPAR > \ 108 RETCONT operator OP(typename INCONT::Tconst_reference value, \ 109 const INCONT& container) \ 110 { return( container OP value ); } 117 #define AFF_OPERATORS_UNOPB( RETCONT, INCONT, OP ) \ 118 template<class A , class B > \ 119 RETCONT< A >& operator OP ## =(RETCONT< A >& container1, \ 120 const INCONT< B >& container2) \ 122 aff::Iterator< RETCONT< A > > i1(container1); \ 123 aff::Browser< INCONT< B > > i2(container2); \ 124 while ( i1.valid() && i2.valid() ) \ 125 { (*i1) OP ## = (*i2); ++i1; ++i2; } \ 126 return(container1); \ 134 #define AFF_OPERATORS_BINOPB( RETCONT, INCONT, OP ) \ 135 template<class A , class B > \ 136 RETCONT< A > operator OP(const INCONT< A >& container1, \ 137 const INCONT< B >& container2) \ 139 RETCONT< A > retval(container1.shape()); \ 141 aff::Browser< INCONT< A > > i1(container1); \ 142 aff::Browser< INCONT< B > > i2(container2); \ 143 aff::Iterator< RETCONT< A > > o(retval); \ 144 while ( i1.valid() && o.valid() && i2.valid() ) \ 145 { (*o) = (*i1) OP (*i2); ++o; ++i1; ++i2; } \ 156 #define AFF_OPERATORS_THEUNOP( OP ) \ 157 AFF_OPERATORS_UNOP( AFF_OPERATORS_CONT , OP ) 163 #undef AFF_OPERATORS_THEUNOP 170 #define AFF_OPERATORS_THEBINOP( OP ) \ 171 AFF_OPERATORS_BINOP( AFF_OPERATORS_CONT , AFF_OPERATORS_CONSTCONT, OP ) 177 #undef AFF_OPERATORS_THEBINOP 184 #define AFF_OPERATORS_THEBINOP( OP ) \ 185 AFF_OPERATORS_BINOPB( AFF_OPERATORS_CLASS , AFF_OPERATORS_CONSTCLASS , OP ) 191 #undef AFF_OPERATORS_THEBINOP 198 #define AFF_OPERATORS_THEUNOP( OP ) \ 199 AFF_OPERATORS_UNOPB( AFF_OPERATORS_CLASS , AFF_OPERATORS_CONSTCLASS , OP ) 205 #undef AFF_OPERATORS_THEUNOP 207 #undef AFF_OPERATORS_UNOP 208 #undef AFF_OPERATORS_BINOP 209 #undef AFF_OPERATORS_BINOPB 210 #undef AFF_OPERATORS_CONSTCONT 211 #undef AFF_OPERATORS_CONT 212 #undef AFF_OPERATORS_TEMPAR Root namespace of library.
#define AFF_OPERATORS_THEUNOP(OP)
unary operatorsThis makes use of AFF_OPERATORS_THEUNOP and AFF_OPERATORS_UNOP
#define AFF_OPERATORS_THEBINOP(OP)
binary operatorsThis makes use of AFF_OPERATORS_THEBINOP and AFF_OPERATORS_BINOP
Define the iterator class template (prototypes)