Consider this function:
po::parsed_options ParserClass::parseOptions(int argc, char *argv[]) {
return po::command_line_parser(argc, argv)
.options(desc)
.positional(pos)
.run();
}
desc
and pos
are member variables of ParserClass
.
Is this function safe or does it return a parsed_options
object that has pointers pointing to released free store memory because the original object's allocated memory is released when the function returns?
How can you know the semantics? I tried to read the source code to find out but it was a little cryptic to me. The documentation doesn't seem to tell.
If the function is not safe, how could it be fixed? Should you extend the class and define a move operation?