Hacker News new | past | comments | ask | show | jobs | submit login

> I think we are better off with boost than learning this new stuff.

Is this not a relatively direct import from boost:

    http://www.boost.org/doc/libs/1_64_0/doc/html/variant.html
I remember that being relatively painful to use 10 years ago.



Which is why no one uses it. The good thing about boost is you get to evaluate features based on merit and be choosy. Putting these in the standard creates an expectation that developers be aware of how to use them.


I used it together with type() to read the variant's current type and act on that.

The std::variant has a bit nicer API compared to boost with e.g holds_alternative. I expect I would create a make_visitor wrapper myself or use an open source one if needed, but it wasn't needed.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: