
5 Apr
2010
5 Apr
'10
11:07 a.m.
Lorenzo Caminiti wrote:
What do you think of the following macro that implementes this in ISO standard C++ while keeping the above C++0x-like syntax by wrapping it within a preprocessor sequence?
BOOST_CPP0X_FUNCTION( (template)( (std::CopyConstructible)(T) ) (requires)( (Addable<T>) (Assignable<T>) ) (precondition)( (first) (last) ) (postcondition)(total)( (total == result) ) (T) (sum)( (T*)(first) (T*)(last) (T)(result) ) ({ for (; first != last; ++first) result = result + *first; return result; }) )
This reminds me about the time when I tried out LISP programming, but didn't like it. To me it looks like there is very little C++ left in there, sorry. Bo Persson