Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-02-25 05:22:58


Hi,
I just had a couple of bugs caused by the fact that constructor of boost::any
is not explicit. For example:

   void do_something(boost::any& v) { ... }

   class variable {
    /////
        boost::any& value() {}
    };

    variable v;
    do_something(v);

The intention was to call do_somethin on 'v.value()' but non-explicit ctor is
happy to accept 'variable', after which 'do_something' breaks.

Anybody has an opinion? Is non-explicit ctor really necessary?

- Volodya


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