On Mon, Oct 15, 2018 at 7:16 PM Roger Martin via Boost < boost@lists.boost.org> wrote:
Hi,
The Custom Validators documentation https://www.boost.org/doc/libs/1_68_0/doc/html/program_options/howto.html shows
void validate(boost::any& v, const std::vector<std::string>& values, magic_number* target_type, int) {
but the possible templates don't match; the last variable type is an int; the key is matching this last type:
int goes with std::vector<T>*
long goes with T*
it also seems possible to hit the
void validate(boost::any& v, const std::vector<std::basic_string<charT> >& s, boost::optional<T>*, int) {
where it then calls for get_single_string and if you are trying for a multitokens switch args, it'll throw " only takes a single argument".
which also varies if it was parsed by command_line_parser or parse_config_file
command_line_parser: vector size can >= 1 up to number of switch args
parse_config_file: vector size ==1 no matter what the number of args are on the input. just one string with all switch args.
This was tested with 1.65 yet I don't see anything changing in
https://github.com/boostorg/program_options/blob/develop/include/boost/progr...
Please submit a pull request or open a github issue to track this properly. Thanks, Jim