RE: [boost] Re: boost::any: explicit constructor?

25 Feb
2004
25 Feb
'04
2:01 p.m.
From: Edward Diener [mailto:eddielee@tropicsoft.com]
The intention was to call do_somethin on 'v.value()' but non-explicit ctor is happy to accept 'variable', after which 'do_something' breaks.
This is a programming error, not an error in boost::any.
Absolutely, but it's an error that could have been detected by the compiler given an explicit constructor. [snip]
While I am not against syntactic sugar which make it easier to use C++ constructs, I am against making a constructor explicit just to keep programmers from making errors.
Isn't keeping programmers from making errors a Good Thing? For me, that's exactly the reason why boost::any's constructor _should_ be explicit. Bjorn
7776
Age (days ago)
7776
Last active (days ago)
0 comments
1 participants
participants (1)
-
Bjorn.Karlsson@readsoft.com