|
Boost Users : |
Subject: Re: [Boost-users] boost::variant & c++11
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2013-05-10 15:31:59
2013/5/8 Igor R <boost.lists_at_[hidden]>:
>> #include <boost/variant.hpp>
>> //A simplified wrapper
>> template<typename T>
>> struct wrap {
>> T t;
>> wrap(T& _t) : t(_t) {}
>> operator T() const {
>> return t;
>> }
>> T force() const {
>> return t;
>> }
>> };
>>
>> struct A{}; struct B{};
>>
>> typedef boost::variant<A, B> my_variant;
>>
>> int main() {
>> A a;
>> my_variant x(a);
>> #ifndef WAR
>> my_variant y = wrap<my_variant>(x);
>> #else
>> my_variant y = wrap<my_variant>(x).force();
>> #endif
>> }
>>
>> And the error:
>>
>> /home/bcatanzaro/boost_1_53_0/boost/variant/variant.hpp:1574:9: error: no
>> matching function for call to boost::variant<A,
>> B>::initializer::initialize(void*,
>> std::remove_reference<wrap<boost::variant<A, B> >&>::type)
>
>
> FWIW, your case can be reproduced with even more trivial code:
>
> #include <boost/variant.hpp>
>
> typedef boost::variant<int> my_variant;
> struct convertible
> {
> operator my_variant() const
> {
> return my_variant();
> }
> };
>
> int main()
> {
> convertible x;
> my_variant y = x;
> }
I'll take care of that issue, but not 100% sure that there will be
enough time to push fix to 1.54.
There is a ticket for that issue: https://svn.boost.org/trac/boost/ticket/8555 .
-- Best regards, Antony Polukhin
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