
Matthew Chambers <matt.chambers42 <at> gmail.com> writes:
Did you ever use boost.convert on a non-defaultable type? I've never needed that.
It might come a surprise but non-defaultable types are the overwhelming majority of our classes. Easily 9:1. And I'd like to stress *our* classes and not just wacko-Vladimir's. And, yes, 'convert' is used well beyond ints and the like. The direction class in 'convert' documentation is a real class and we have plenty of similar ones not to mention considerably more complex. An enumerator as simple as enum hamlet_problem { to_be, not_to_be }; has no default. I am not sure if extending the above to enum hamlet_problem { to_be, not_to_be, i_dont_know }; will be helpful for poor Hamlet. From the design perspectives adding elements not relevant to the domain (i_dont_know) is pollution. I won't be surprised if you find a lot of non-defaultable types if you look closely around without pre-disposition that any class is supposed to have the default constructor. One needs to remember that the default constructor was introduced in C++ (if my memory serves me) so that objects would not be in an invalid state like 'int i;' can be. If one introduces the default constructor which does not, in fact, construct a valid object, then it seems to defeat the purpose. V.