Boost logo

Boost :

From: Max Motovilov (max_at_[hidden])
Date: 2004-02-25 22:18:08

"Joel de Guzman" <joel_at_[hidden]> wrote in message

> > If you want a newer technology, there's one in the boost-sandbox.
> > See: boost/utility/type_deduction.hpp
> > and a test program: libs/utility/type_deduction_tests.cpp.

Joel, thanks for posting the direct URLs, as I don't have access to sandbox.
I tried it out - works like a charm, and compiles much faster than BLL
(well, obviously....). FWIW, here's what the "universal operator+" becomes

template< typename T1, typename T2, template< typename _ > class DAT >
typename boost::disable_if_c<
    do_not< promote_sum< DAT > >::value,
    DAT< typename boost::result_of_plus<T1,T2>::type >
>::type operator+( const DAT<T1>& a, const DAT<T2>& b )
    typedef DAT< typename boost::result_of_plus<T1,T2>::type > T;
    return T( a ) + T( b );

(promote_sum<> and do_not<> stay unchanged).


Boost list run by bdawes at, gregod at, cpdaniel at, john at