Hello!
Does someone know if the boost::get
for the boost::variant
is a performance-consuming operation or not.
Right now I am refactoring some old code in a performance-critical part, where "varianting" was implementing by containers for each possible types and corresponding enum
.
Obviously, this is fast, but ugly and right now when I have to refactor the code so that it would work with one more type, I want to get rid of that old part of code and replace it with boost::variant
.
Also, I can't simple "profile both variants and compare" because this refactoring is a pain in the ass and would be pretty time consuming.
So, if someone knows how does boost::get<x>
performs comparing to generic enum-based
type dispatching, I would appreciate if you share this knowledge.
There is another variant of using boost::variant<types>
with custom visitor (as described in boost::variant
documentation) - may this be faster than boost::get
in my case?
Thank you.