Reputation: 6632
Suppose there is
boost::variant<int, std::string> v;
How do I get a reference x of type std::string & that could be used like
x
std::string &
x = "abc";
and would have a behaviour equivalent to
v = "abc";
?
Upvotes: 3
Views: 1946
Reputation: 3260
std::string& x = boost::get<std::string>(v);
Upvotes: 6