
On Jul 3, 2004, at 6:47 PM, Andy Little wrote:
I have seen this, but BTW I cant find the utilities/detail/result_of_iterate.hpp header in the boost CVS
??? It's there (and the regression tests are finding it). Are you using "cvs update -d"?
result_of is a a general purpose tool. My point is that when dealing with 'operators' as opposed to functions in general it is much more convenient to have one one class representing the operation than a plethora of result_of_xxx classes. Take a look in Lambda, Ublas etc etc... currently they all do their own thing on operators
If we had "smarter" versions of std::plus, std::minus, etc. that played well with result_of, I think that would solve the issue reasonably well.
One common interface class (ie binary_operation) for operators would sure help when designing matrix operators etc. To do that you need a template parameter capable of representing the generic operation.
... which is just a function object. Something like this: struct minus { template<typename> struct result; template<typename F, typename T, typename U> struct result<F(T, U)> { typedef *magic* type; }; template<typename T, typename U> typename result<minus(T, U)>::type operator()(T t, U u) { return t+u; } } Doug