boost-program-options

Boost parse_config_file, empty key value

删除回忆录丶 提交于 2021-02-17 21:35:24
问题 I am using Boost program_options to parse a config file in the standard way as shown in the multiple_sources.cpp example file of program_options. ifstream ini_file("config.ini"); po::store(po::parse_config_file(ini_file, desc, true), vm); po::notify(vm); The config.ini file however has empty key=value pairs such as: key1=value1 key2=value2 key3= key4= key5=value5 Trying to read this file results in a Boost error: boost::program_options::invalid_option_value Is there any mechanism in boost:

Boost parse_config_file, empty key value

北城以北 提交于 2021-02-17 21:34:33
问题 I am using Boost program_options to parse a config file in the standard way as shown in the multiple_sources.cpp example file of program_options. ifstream ini_file("config.ini"); po::store(po::parse_config_file(ini_file, desc, true), vm); po::notify(vm); The config.ini file however has empty key=value pairs such as: key1=value1 key2=value2 key3= key4= key5=value5 Trying to read this file results in a Boost error: boost::program_options::invalid_option_value Is there any mechanism in boost:

Using boost::program_options with enum in class in namespace

余生颓废 提交于 2021-02-09 10:52:30
问题 I'm using boost::program_options to parse the command line for my program and am having trouble trying to read a value into a public enum in a class which is also in a namespace. Specifics: Boost 1.44.0 g++ 4.4.7 I tried following the process spelled out in Boost Custom Validator for Enum but it isn't working for me. Parameters.h #include <istream> namespace SA { class Parameters { public: enum Algorithm { ALGORITHM_1, ALGORITHM_2, ALGORITHM_3, ALGORITHM_4 }; friend istream& operator>>

Using boost::program_options with enum in class in namespace

人走茶凉 提交于 2021-02-09 10:49:33
问题 I'm using boost::program_options to parse the command line for my program and am having trouble trying to read a value into a public enum in a class which is also in a namespace. Specifics: Boost 1.44.0 g++ 4.4.7 I tried following the process spelled out in Boost Custom Validator for Enum but it isn't working for me. Parameters.h #include <istream> namespace SA { class Parameters { public: enum Algorithm { ALGORITHM_1, ALGORITHM_2, ALGORITHM_3, ALGORITHM_4 }; friend istream& operator>>

How to store data in boost::program_options::variable_map?

戏子无情 提交于 2021-01-28 09:13:31
问题 I am currently trying to rework some code that was handed down to me. The original point of the code is to read a configuration file, and to set up the different options in the file in a boost::program_options::variable_map, which is then read throughout other parts of the code which is already working fine. Here is the code I am trying to replace: // Some helpful definitions boost::program_options::variables_map vm; std::string filecfg = "File_name"; std::ifstream ifs(filecfg.c_str()); //

How can I suppress a stack-buffer-overflow from AddressSanitizer in gcc

ぐ巨炮叔叔 提交于 2020-05-29 10:16:37
问题 My app is using boost::program_options and it's triggering an AddressSanitizer "stack-buffer-overflow" while generating an error message from an exception. I'm not worried about the boost bug - the functionality works and this is just in the command line parsing portion of a non-production app. However I'd like to suppress the AddressSanitizer message. ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffe6ce7070 at pc 0x0000007406cd bp 0x7fffe6ce6fe0 sp 0x7fffe6ce6fd8 READ of size

boost::program_options custom validate and default value

 ̄綄美尐妖づ 提交于 2020-01-06 05:48:14
问题 I am using boost::program_options to parse arguments. Because I cannot break compatibility I need to allow specifying some arguments multiple times. I need to do it for example for strings (last one wins) or for booleans (every occurence switches the value). Let's show what I have on bool (for strings it should be easier because it does not matter what the default is when parameter is used, because it is overwritten with new value). I have my own class BoolValue and custom validate function

How can I build an individual boost library forked cloned from git?

。_饼干妹妹 提交于 2020-01-05 07:29:39
问题 Boost using this build system I'm not otherwise familiar with, based on "Jam" files. Now, I've forked and cloned a specific Boost library (program_options), and I want to build it and perhaps also run the tests. I notice a build/Jamfile.v2 - what should I do with it? I tried apt-get install jam on my distribution, but that did not get me very far: $ jam -fbuild/Jamfile.v2 warning: unknown rule project warning: unknown rule boost-lib don't know how to make all ...found 2 target(s)... ...can't

How can I build an individual boost library forked cloned from git?

霸气de小男生 提交于 2020-01-05 07:29:06
问题 Boost using this build system I'm not otherwise familiar with, based on "Jam" files. Now, I've forked and cloned a specific Boost library (program_options), and I want to build it and perhaps also run the tests. I notice a build/Jamfile.v2 - what should I do with it? I tried apt-get install jam on my distribution, but that did not get me very far: $ jam -fbuild/Jamfile.v2 warning: unknown rule project warning: unknown rule boost-lib don't know how to make all ...found 2 target(s)... ...can't