hi,
what is needed for the lexicographic class to be included into boost?
if it is a formal review (probably a really short one) i want to request it. maybe it can also be reviewed together with other utility components.


the current version is in the boost-sandbox and consists of the following three files:
boost/utility/lexicographic.hpp
libs/utility/doc/lexicographic.html
libs/utility/test/lexicographic_test.cpp



and again a small decription ----------------------------

It is a small class which helps to avoid error-prone if-else cascades if a certain lexicographic order for different sorting criteria has to be implemented.

example:

struct person
{
        int age;
        std::string firstname, lastname;
};

bool operator < (person const &p1, person const &p2)
{
        return boost::lexicographic
                (p1.lastname, p2.lastname, cmp_lower)
                (p1.firstname, p2.firstname, cmp_lower)
                (p2.age, p1.age);
}

...

std::set <person> group;

now the member of group are sorted after last name in ascending order independent of lower or upper case. if the last name is equal they are sorted after the first name in the same manner, and if the whole name is equal they are sorted according to their age, with old people in front of the set.

jan

--
jan langer ... [EMAIL PROTECTED]
"pi ist genau drei"


_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to