Boost logo

Boost Users :

From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2008-05-16 04:34:54


 <peter_foelsche <at> agilent.com> writes:
> currently I get a compiler error if I try
> to pass a string literal to a boost::any.
>
> I guess the same happens if you pass an
> array.

Formally speaking, arrays don't satisfy ValueType requirements
because they are not CopyConstructible. Pointers are normally not
ValueTypes either (because you can't copy them freely, you have
to remember of a scope of an object they point to).

So, it's good that your code doesn't compile. If you intend to pass
an array use boost::arrary, otherwise cast explicitly.

http://www.boost.org/doc/libs/1_35_0/doc/html/any/reference.html#any.ValueType

--
Alexander

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net