Thanks guys :)

-----Original Message-----
From: Vladimir Prus [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 31, 2003 11:02 AM
To: Boost mailing list
Subject: Re: [boost] any_cast issues


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");

HTH,
Volodya


_______________________________________________
Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to