structopt icon indicating copy to clipboard operation
structopt copied to clipboard

boost::pfr

Open xR3b0rn opened this issue 2 years ago • 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.

xR3b0rn avatar Nov 29 '23 21:11 xR3b0rn

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.

p-ranav avatar Nov 30 '23 14:11 p-ranav

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

xR3b0rn avatar Nov 30 '23 18:11 xR3b0rn

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.

schaumb avatar Jan 01 '24 07:01 schaumb