p-ranav/structopt

boost::pfr

Opened this issue · 3 comments

In the current beta release of boost, boost::pfr comes with a new feature for extracting the struct name from a given type. This way structopt could get rid of the library visit_struct and fully rely on boost::pfr. Or, since the new boost::pfr feature requries C++20, to still support older C++ standards , the current reflection mechanism might stay as fallback.

From here, it looks to me like they figured out how to get the field names to appear in FUNCSIG strings for functions templated on the object, and then parse them out of that.

I will try and test it out soon, it seems there are some limitations, not sure how much (if at all) that would affect the structopt feature list.

I assumed the string is parsed from the func sig. I still wonder why it requires C++20.

Hi @xR3b0rn ! Thanks for mentions my method here! This hack is usable only for C++20 because it uses the P1907R1 standard modification. Before this, the template hack cannot be used.
I can help implement this feature.