I'm looking at this code and found some peculiarities.
source: https://sourceforge.net/projects/bin2header/files/v0.4-test/bin2header-0.3.1.tar.xz/download
in the file: bin2header.cpp, you find the following code:
options.add_options()
("h,help", "")
("v,version", "")
("o,output", "", cxxopts::value<string>())
("n,hname", "", cxxopts::value<string>())
("s,chunksize", "", cxxopts::value<unsigned int>())
("d,nbdata", "", cxxopts::value<unsigned int>())
("c,datacontent", "")
("f,offset", "", cxxopts::value<unsigned long>())
("l,length", "", cxxopts::value<unsigned long>())
("p,pack", "", cxxopts::value<unsigned int>())
("e,swap", "")
("stdvector", "")
("eol", "", cxxopts::value<string>());
the function "add_options()"
defined in "cxxopts.hpp" accepts multiple arguments with "(" and ")".
some contain 2 options and other contain 3.
How does that work?
i saw the usage of this: std::initializer_list
https://en.cppreference.com/w/cpp/utility/initializer_list
but the demonstrated example on CPP reference isdifferent.
Further more, cxxopts::value<string>()
, this value<string>()
, value + datatype between "<" and ">" followed by "()".
Also defined in "cxxopts.hpp":
template <typename T>
std::shared_ptr<Value>
value()
{
return std::make_shared<values::standard_value<T>>();
}
template <typename T>
std::shared_ptr<Value>
value(T& t)
{
return std::make_shared<values::standard_value<T>>(&t);
}
What the clue behind that?