Boost logo

Boost Users :

From: MB (mb2act_at_[hidden])
Date: 2006-01-14 17:45:33


Sebastian Redl wrote:
> MB wrote:
>
>
>>Hi,
>>
>>Does boost has anything like :
>>
>> template< class T > inline
>> const T& const_(const T& x)
>> {
>> return x;
>> }
>>
>>
>>I guess that boost::cref is different...
>>
>>
>
> What exactly is the use of this? Did you perhaps mean to make the
> parameter non-const? If so, why would you need a function for something
> that's an implicit cast anyway?

Hi,

A short story is:

   struct X { };
   void f(X& x);
   void f(const X& x);

   void test()
   {
     X x; {
       // initialize x.
     }

     f(const_(x));
   }

Here is the long story:
   http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2004/n1674.pdf

Regards,
MB
p-stade.sourceforge.net


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