Boost Program_options - comments on configuration files

I have a program that reads a large number of variables from a configuration file using boost :: program_options. The configuration file works and reads the values, however, since there are many parameters in the file, I would like to document them in place. For example, I want the configuration file to look like this:

# Here is a description of flag1
#    flag1 = true means blah blah blah
#    flag1 = false means ...
flag1=true
# Here is a description of flag 2
.
.
.

The problem is that I cannot find the documentation anywhere that describes a way to do this. I am pretty sure that I could use something like a=for my comment separator and just assign all the comments std::vector<string>that will be thrown after parsing, however I would like to know if there is a more suitable way to handle comment lines in the configuration file.

+5
source share
1 answer

The documentation is program_optionsreally bad.

In fact, it already supports comment lines starting with '#'. He throws out these lines. You do not need to do anything to do this work, it is done implicitly. It does not work with '//', etc.

+6
source

All Articles