Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-09-29 17:03:41


In the case where there is BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION,
call_traits<T>::const_reference is a reference type, which can result in
references-to-references. I guess that's the right choice if you want the
fastest speed in all cases but you're willing to have your code not compile
when T is a reference. I'm in the opposite situation: I want my code to
always compile, and where available, I want an optimization. So I find
myself writing:

#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
    typedef MemberType ExtractType;
#else
    typedef typename boost::call_traits<MemberType>::const_reference
ExtractType;
#endif

It seems to me that call_traits<> should support this directly, either by
changing the definition of const_reference for the
BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION case, or by adding another typedef
to call_traits<>.

Thoughts?

-Dave


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