You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great of boost::program_options::variables_map could have transparent comparator support (c++14 feature), to potentially avoid unnecessary object creation when accessing values in the map. Theoretically only a std::less<> needs to be added as the third template parameter of the std::mapvariables_map inherits from. Currently:
// 1
boost::program_options::variable_map vm;
vm.find("test"); // implicit std::string object created and destoryed // 2
std::string_view sv("test");
vm.find(sv); // does not compile// 3
vm.find(std::string(sv)); // only way to inspect with a std::string_view, explicit std::string object created and destroyed
With a transparent comparator 1 will not create a std::string object and just compare directly against the c-string literal. 2 will work as shown without any extra objects being created. 3 will be unnecessary
The text was updated successfully, but these errors were encountered:
It would be great of
boost::program_options::variables_map
could have transparent comparator support (c++14 feature), to potentially avoid unnecessary object creation when accessing values in the map. Theoretically only astd::less<>
needs to be added as the third template parameter of thestd::map
variables_map
inherits from. Currently:With a transparent comparator 1 will not create a
std::string
object and just compare directly against the c-string literal. 2 will work as shown without any extra objects being created. 3 will be unnecessaryThe text was updated successfully, but these errors were encountered: