Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-12-15 15:55:00


Hi,

I think the following little metaprogram would make a useful addition to
call_traits. Given an argument type, it selects a type to pass through an
intermediate function. That can be useful for the many forwarding functions
needed in C++ library construction:

#include <boost/ref.hpp>

template <class T>
struct passthru
{
    typedef typename mpl::select_type<
        is_scalar<T>::value | is_reference<T>::value
        , T
        , reference_wrapper<T const> >::type type;
};

I would probably call this call_traits<T>::passthru_type.

Comments?

-Dave

===================================================
  David Abrahams, C++ library designer for hire
 resume: http://users.rcn.com/abrahams/resume.html

        C++ Booster (http://www.boost.org)
          email: david.abrahams_at_[hidden]
===================================================


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