Boost logo

Boost :

From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2002-08-27 09:55:36


----- Original Message -----
From: "Anthony Williams" <anthwil_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Tuesday, August 27, 2002 11:18 AM
Subject: [boost] value_initialized<> uploaded to be Files Section.

> > I've worked-around the 'operator T&() const' problem by providing a
strict
> > deep-constant non-member get() function, which is presented as the
> > recommended idiom.
>
> If you're going to provide a non-const reference to a member of a const
> object, that member had better be mutable....
>
In general, yes; but in my particular case this has a drawback:

template<class T>
struct W
{
  operator T&() const { return x ; }
  mutable T x ;
} ;
W<int const> w ; // ERROR: Conflicting type modifiers: mutable const int x
;

This is why I chosen to use const_cast<> instead.

Fernando Cacciola
Sierra s.r.l.
fcacciola_at_[hidden]
www.gosierra.com


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