繁体   English   中英

boost变量:按类型引用变量

[英]boost variant: get reference to the variant by its type

假设有

boost::variant<int, std::string> v;

我如何获得类型为std::string &的引用x ,可以使用类似的

x = "abc";

并且会有相当于的行为

v = "abc";

std::string& x = boost::get<std::string>(v);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM