Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2005-12-19 19:01:29

Hi Arkadiy,

"Arkadiy Vertleyb" wrote
> Hi Andy,
> If every library author uses his/her own typeof emulation mechanism, not
> only the effort will be repeated every time, but also types composed from
> different libraries, such as liba::x<libb::y>, would not be handled...
> Or did I misinterpret your statement? Maybe you implied that you will use
> typeof for your library interface, while avoiding it in the implementation?

I guess it was misleading. I am currently wrapping Typeof in a class template

template <typename Lhs, typename Op, typename Rhs>
struct binary_operation;

template <typename Lhs,typename Rhs>
struct binary_operation<Lhs, plus, Rhs>
// arithmetic types but allowing customisation
where is_value_type<Lhs> && is_value_type<Rhs>
    typedef BOOST_TYPEOF_TPL( Lhs() + Rhs()) type;

Now its also possible to use typeof or not as I please via a macro. (It might be
useful to find the difference in cvompile times anyawy) Note that its not
actually required to use typeof in my own definitions, IOW the interface, but
other libraries can use typeof and will work Ok with my library ( types are

template <typename Lhs, typename Rhs>
where is_quantity<Lhs> && is_quantity<Rhs>
typename binary_operation<Lhs,plus,Rhs>::type
operator +( Lhs const & lhs, Rhs const & rhs);

IOW its not really an interface versus implementation thing really. Does that
make any sense?

Andy Little

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