In an answer to this SO question:
What is the equivalent of boost::variant in the C++ standard library?
it is mentioned that boost::variant
and std::variant
differ somewhat.
- What are the differences, as far as someone using these classes is concerned?
- What motivation did the committee express to adopt
std::variant
with these differences?
- What should I watch out for when coding with either of these, to maintain maximum compatibility with switching to the other one?
(the motivation is using boost::variant
in pre-C++17 code)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…