Boost logo

Boost :

From: Ferdinand Prantl (prantlf_at_[hidden])
Date: 2008-07-09 17:03:04

On Wed, Jul 9, 2008 at 10:16 PM, Daryle Walker wrote:
> Arrays are badly-copyable because the C++ committee has never fixed them
> from their half-done status (unlike struct). Maybe we should take the lead
> and make a special case for allowing array objects in an boost::any. (Note
> for the string case, we have to include the terminating NUL, so the rules
> won't be irregular with non-character types, and for non-string arrays that
> just happen to have a character type for elements [i.e. due to template
> code].)

The question would be - do we want boost::any to be implicitely
constructible and assignable from constant arrays?
(I say I do, indeed, but... :-)

If yes, another question would be how to store arrays. They are passed
as pointers to functions. The easiest option would be to "downgrade"
them the same way and store them as pointer to their first element.
Then a boost::any object would not contain a copy of the array but
a copy of the pointer.

Storing the array as a full copy with its exact type brings more
questions like handling multidimensional arrays, avoiding assignments
when copying the array and how to get the array from the boost::any
object by boost::any_cast.


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