Boost logo

Boost :

From: Joel de Guzman (djowel_at_[hidden])
Date: 2002-07-03 08:23:57


David Abrahams wrote:

>I've got no problem with accepting this patch, provided:
>
>1. It passes all the existing tests, with BOOST_NO_NRVO in both states
>2. Aleksey and Daryle agree
>3. The macros are prefixed with BOOST_
>4. The backslashes are lined up for readability (emacs has a key which does
>this):
>
>#define BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( NAME, OP ) \
>template <class T, class U, class B = ::boost::detail::empty_base> \
>struct NAME##2 : B \
>{ \
> friend const T operator OP( const T& lhs, const U& rhs ) \
> { T nrv( lhs ); nrv OP##= rhs; return nrv; } \
>}; \
> \
>template <class T, class U, class B = ::boost::detail::empty_base> \
>struct NAME##2_left : B \
>{ \
> friend const T operator OP( const U& lhs, const T& rhs ) \
> { T nrv( lhs ); nrv OP##= rhs; return nrv; } \
>}; \
> \
>template <class T, class B = ::boost::detail::empty_base> \
>struct NAME##1 : B \
>{ \
> friend const T operator OP( const T& lhs, const T& rhs ) \
> { T nrv( lhs ); nrv OP##= rhs; return nrv; } \
>};
>
Hi,

May I suggest that the macros be placed in an independent hpp file? This
should be
useful for those who want to take advantage of the optimizations but do
not need
the boost operators library.

Many thanks,
--Joel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk