-4

It's awful old, copyright 2003. It lists compatibility with GCC 3.1, and GCC 5.3 is out now. I want to use it, but I want to make sure it's still being maintained before I use it in my code base.

BeeOnRope
  • 60,350
  • 16
  • 207
  • 386
djhaskin987
  • 9,741
  • 4
  • 50
  • 86
  • My colleague also noted that boost::variant is still being actively maintained! Until other standards are adopted, I think I'll go with boost::variant, since it's easy to sell boost as a dependency. http://www.boost.org/users/history/version_1_61_0.html – djhaskin987 Jun 20 '16 at 18:38

1 Answers1

3

Boost.Variant is still useable, but like you say, it's showing its age. It's a C++98 library, so it emulates variadic templates, which means there's an upper limit on the number of options you can have in one variant. It also requires visitors to inherit from boost::static_visitor, which is annoying. But if you're still stuck with C++98 then it's probably still the best option there is.

For C++11/14 projects, I'd recommend using eggs.variant or this impementation of std::experimental::variant (which will likely be part of C++17).

Tristan Brindle
  • 16,281
  • 4
  • 39
  • 82
  • for C++14 you can supply a generic lambda as a visitor (scroll down to the bottom here: https://meetingcpp.com/index.php/br/items/boostvariant-and-a-general-generic-visitor-class.html) – m.s. Jun 15 '16 at 21:07
  • 1
    looks like `eggs::variant` does not support storing references, a feature I often need and `boost::variant` provides – m.s. Jun 15 '16 at 21:13