Boost logo

Boost Users :

Subject: Re: [Boost-users] [Multi-Index] crash on iterator copy or assignment
From: Peter Dimov (pdimov_at_[hidden])
Date: 2009-03-13 11:23:56


Dominique Devienne:
> Does using the explicit keyword precludes the "type var = rhs;" <==> "type
> var(rhs);" equivalence that I've assimilated (incorrectly?) into my mental
> model of C++?

Yes.

T x = v; causes an implicit conversion of v to T, with which x is then
copy-constructed. This is routinely optimized to T x( v ); but the compiler
is still required to check for the presence of an implicit conversion (which
'explicit' prevents) and an accessible copy constructor.


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