|
Boost : |
From: Daniel Wallin (dalwan01_at_[hidden])
Date: 2004-04-13 07:01:27
Thorsten Ottosen wrote:
> "Daniel Wallin" <dalwan01_at_[hidden]> wrote in message
> news:407BC506.6020209_at_student.umu.se...
>
>
>>How about this:
>
>
> [snip]
>
> it's better, although I can't compile it on comeau 4.3. gcc and vc7 seems to
> like it.
> I'm know sure there can be made a normal boost-hacked implementation that
> will work nicely
> on many platforms. We just someone to do it.
OK, this works on comeau:
template<class T> struct cant_mutate_const_values
{
typedef int type;
};
template<class T> struct cant_mutate_const_values<T const>
{
template<class U> struct error {};
typedef typename error<T>::type type;
};
template<class T>
T& mutate_rvalue(T const& x)
{
return const_cast<T&>(x);
}
template<class T>
T& mutate_rvalue(T& x, typename cant_mutate_const_values<T>::type = 0)
{
return x;
}
-- Daniel Wallin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk