Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2008-07-09 16:16:31


On Jul 9, 2008, at 3:57 PM, Mathias Gaunard wrote:

> Ferdinand Prantl wrote:
>> Hello,
>>
>> I would like to improve usage of boost::any with text (char*)
>> constants.
>> This would be the goal:
>>
>> boost::any foo("foo");
>
> This is not a char*. There is no problem putting a char* in a
> boost::any.
> It's a const char[N]. An array.
> To insert an object into a boost::any, the object needs to be
> copyable.
> Arrays aren't. The end.

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].)

-- 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT hotmail DOT com

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