[C++-sig] Must be CopyConstructible for stringification?

Andreas Kloeckner ak at ixion.net
Wed Feb 25 12:33:14 CET 2004

Hi all,

I've discovered that in order to have a __str__ method, i.e. to be able to

  .def( self_ns::str(self))

on a class_, it has to be CopyConstructible, or rather, is copy
constructed when passed to boost::lexical_cast. This strikes me as
slightly odd, since a reference would have done just as well, and not
everything that can be sensibly stringified is also copyconstructible
(or cheaply so, thinking matrices and lists).

In short: Wouldn't it make sense to pass lexical_cast a reference
instead of a copy?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20040225/965e5faa/attachment.pgp>

More information about the Cplusplus-sig mailing list