Re:Show HN: Add a command-line interface to any C++ program
by gpderetta on Saturday October 16, 2021 @10:58AM
(#28888294)
Lexical cast, aside a couple of specializations, is just a wrapper over iostream, so probably you only need to define operator>> and <<.
Re:Show HN: Add a command-line interface to any C++ program
by chrisaycock on Saturday October 16, 2021 @09:21AM
(#28887696)
Yes, in theory. I've never tried to specialize lexical_cast since it's a Boost library and likely has its own assumptions. But I imagine it's possible if you want to handle things like arrays or user-defined types.
If I understand the design correctly, one can provide a custom argument parser by specializing lexical_cast?