Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-01-31 04:01:38

Greg Dehaas wrote:
> Hi All,

> boost::any test = "Test Me";
> And the error message is:
> c:\dev\boost\boost\any.hpp(105) : error C2536: 'boost::any::holder<char
> [8]>::held' : cannot specify explicit initializer for arrays
> c:\dev\boost\boost\any.hpp(122) : see declaration of 'held'
> c:\dev\boost\boost\any.hpp(103) : while compiling class-template
> member function '__thiscall boost::any::holder<char
> [8]>::boost::any::holder<char [8]>(const char (&)[8])'

Hmm... the same problem can be seen if you try

    std::make_pair("1", "2");

the template parameters are deduces as char[1] and char[1], and there's no
much you can do with that type, not even copy it. That's the way template
argument deduction works, IIRC. I suggest that you change ctors of any and
any::holder to take value instead of reference, and tell what you got. Of
course, you should be able to say

   boost::any test = static_cast<const char*>("Test me");


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