[program_options] Bug in example and documentation
Hi,
I believe the example found in example/response_file.cpp and referenced in
the documentation has a bug.
In the following code fragment a temporary string object is passed as the
first argument to the tokenizer constructor.
This string is destroyed before the iteration over the tokens start.
/Peter
if (vm.count("response-file")) {
// Load the file and tokenize it
ifstream ifs(vm["response-file"].as<string>().c_str());
if (!ifs) {
cout << "Could not open the response file\n";
return 1;
}
// Read the whole file into a string
stringstream ss;
ss << ifs.rdbuf();
// Split the file content
char_separator<char> sep(" \n\r");
tokenizer
participants (1)
-
Peter Gerell