Boost logo

Boost Users :

Subject: Re: [Boost-users] add_const_ref type transformation metafct
From: Nat Goodspeed (nat_at_[hidden])
Date: 2009-04-04 09:41:49


Hicham Mouline wrote:

> I wish to have a metafct that adds "const &" to types that have it or don't
> have it...
>
> template< typename T >
> struct add_const_ref {
> typedef typename boost::remove_const<T>::type t1;
> typedef typename boost::add_const<t1>::type t2;
> typedef typename boost::add_reference<t2>::type type;
> };
>
> Does this exist already in type traits or elsewhere? I couldn't find....

How about boost::call_traits<T>::param_type?
http://www.boost.org/doc/libs/1_38_0/libs/utility/call_traits.htm


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net