|
Boost Users : |
Subject: [Boost-users] [program_options] Problem using value<string>()->zero_tokens() with config file
From: Marcio Paim de Aquino (marcio.paim_at_[hidden])
Date: 2008-09-18 08:30:22
Hi,
I have the following code section:
po::options_description config;
config.add_options()
( "HOST", po::value<string>(&host) )
( "USER", po::value<string>(&user) )
( "PASSWD", po::value<string>(&passwd) )
( "DATABASE", po::value<string>(&database) )
( "PORT", po::value<int>(&port) )
( "VERTEX.WEIGHT", po::value<string>()->zero_tokens() );
po::variables_map vm;
ifstream ifs( "myfile.conf" );
store( parse_config_file( ifs, config ), vm );
notify( vm );
If in myfile.conf I leave WEIGHT blank like this
[VERTEX]
WEIGHT =
I get the following error message:
terminate called after throwing an instance of
'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::program_options::invalid_syntax>
>'
what(): no value given in 'WEIGHT ='
Aborted
Someone can tell whats is wrong?
Thanks
Marcio
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net