Opened 11 years ago
Last modified 10 years ago
#5654 new Bugs
Example parse_config_file missing template parameter
Reported by: | Owned by: | Vladimir Prus | |
---|---|---|---|
Milestone: | Boost 1.48.0 | Component: | program_options |
Version: | Boost 1.46.1 | Severity: | Cosmetic |
Keywords: | Cc: |
Description
store(parse_config_file("example.cfg", desc), vm);
parse_config_file needs a template parameter in this case.
http://www.boost.org/doc/libs/1_46_1/doc/html/program_options/overview.html#id2218686
Change History (12)
comment:1 by , 11 years ago
comment:3 by , 11 years ago
Ah - perhaps this is a bug in 4.2? The "const char*" overload does not resolve on my system - boost1.42-all-dev on Ubuntu Lucid using g++ 4.4.3.
comment:5 by , 11 years ago
Replying to Olaf van der Spek <olafvdspek@…>:
4.2? Try 1.47.
Sorry - I meant 1.42, but 1.47 is not readily available for me (as in not packaged in backports), and since the workaraound is acceptable, and the project late (as ever), I won't get around to this I am afraid. I can confirm that it does not work with an extra (true or false) template parameter either. But I guess bugs for 1.42 are somewhat irrelevant at this stage.
comment:7 by , 11 years ago
It is declared in the header I have.
template<class charT> #if ! BOOST_WORKAROUND(__ICL, BOOST_TESTED_AT(700)) BOOST_PROGRAM_OPTIONS_DECL #endif basic_parsed_options<charT> parse_config_file(const char* filename, const options_description&, bool allow_unregistered = false);
comment:9 by , 11 years ago
Replying to Olaf van der Spek <olafvdspek@…>:
So what error msg do you get when you try the example?
../src/main.cpp:56: error: no matching function for call to ‘parse_config_file(const char [20], boost::program_options::options_description&)’
follow-up: 11 comment:10 by , 11 years ago
Was that fixed or is there any workaround? Got same error with boost 1.47 and GCC 4.6.2.
comment:11 by , 11 years ago
Replying to anonymous:
Was that fixed or is there any workaround? Got same error with boost 1.47 and GCC 4.6.2.
Write: parse_config_file<char>(......); and it works.
comment:12 by , 10 years ago
shouldn't this function be declared as
template<class charT> #if ! BOOST_WORKAROUND(__ICL, BOOST_TESTED_AT(700)) BOOST_PROGRAM_OPTIONS_DECL #endif basic_parsed_options<charT> parse_config_file(const charT* filename, const options_description&, bool allow_unregistered = false);
and just ignore those people who tries to pass an int* or double* or whatever* to it?
parse_config_file appears to require an open istream object (instead of the filename). I think this is a documentation error?