I want to use this Function and make a custom sorting function, but I don't know how the Compare Function works or with a lambda.
Could someone be so kind to give me a working example for using it.
/* Sorts the direct children of this node according to the predicate.
The predicate is passed the whole pair of key and child. */
template <class Compare> void sort (Compare comp);
The predicate is passed the whole pair of key and child.
Is this a pair of key/ptree? I don't know how what the datatype is.
Im searching something like a lambda function equal for lists
unorderedGenList.sort([](const boost::property_tree::ptree & treeA, const boost::property_tree::ptree & treeB)
{
if(std::stod(treeA.get<std::string>("sortA","0")) < std::stod(treeB.get<std::string>("sortA","0"))
|| (std::stod(treeA.get<std::string>("sortA","0")) == std::stod(treeB.get<std::string>("sortA","0")) && std::stod(treeA.get<std::string>("sortB","0")) < std::stod(treeB.get<std::string>("sortB","0")))
)
return true;
return false;
});