Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-02-26 06:32:53

Bjorn.Karlsson_at_[hidden] wrote:

>> From: Vladimir Prus [mailto:ghost_at_[hidden]]
>> The experience in my case is very simple. I had two bugs
>> because constructor
>> is not explicit. I've just made it explicit locally,
>> recomplied and got no
>> complication errors, so convenience was not hurted.
> Yes, an explicit constructor is safer because it would cause those bugs to
> be detected at compile time, but convenience *is* hurt:
> std::vector<boost::any> vec;
> vec.push_back(5);
> With an explicit constructor, the above won't work.

That's right. I used my case, where convenience was not hurt, to illustrate
the the decision that ctor should not be explicit is not entirely obvious.

- Volodya

Boost list run by bdawes at, gregod at, cpdaniel at, john at