I’m currently reading the Boost.Program_options tutorial.
Here is some of the code they introduce:
// Declare the supported options.
po::options_description desc("Allowed options");
desc.add_options()
("help", "produce help message")
("compression", po::value<int>(), "set compression level")
;
I understand the purpose behind this code, however the syntax confuses me. Are the indented lines arguments to a function? What is with the brackets?
I suppose
desc.get_options()returns an object of a class that definesoperator()which in turn returns the same object. So the indented lines are calls to this operator with arguments in brackets.Looking at
boost/program_options/options_description.hppyou can see that the class in question isoptions_description_easy_initwhich indeed has severaloperator()‘s such as: