|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2004-09-01 20:40:33
Stefan Slapeta <stefan_nospam__at_[hidden]> writes:
> see http://tinyurl.com/5639d
>
> Has anybody a solution for this? Seems that all CWs have problems with
> casts in combination with conversion functions.
template<class T>
void test ( T const& y, T const& z )
{
boost::value_initialized<T> x ;
BOOST_TEST ( y == x ) ;
BOOST_TEST ( y == get(x) ) ;
static_cast<T&>(x) = z ;
get(x) = z ;
BOOST_TEST ( x == z ) ;
boost::value_initialized<T> const x_c ;
BOOST_TEST ( y == x_c ) ;
BOOST_TEST ( y == get(x_c) ) ;
static_cast<T&>(x_c) = z ;
### mwcc Compiler:
# File: ..\libs\utility\value_init_test.cpp
# --------------------------------------------
# 76: static_cast<T&>(x_c) = z ;
# Error: ^
# constness casted away
The only solution I can think of is to change the test:
T& t_ref = x_c;
t_ref = z;
or
implicit_cast<T&>(x_c) = z;
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk