...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::log::abstract_ordering — Ordering predicate, based on opaque pointers to the record view implementation data.
// In header: <boost/log/utility/record_ordering.hpp> template<typename FunT = less> class abstract_ordering : private FunT { public: // types typedef bool result_type; // Result type. // construct/copy/destruct abstract_ordering(); explicit abstract_ordering(FunT const &); // public member functions result_type operator()(record_view const &, record_view const &) const; };
Since record views only refer to a shared implementation data, this predicate is able to order the views by comparing the pointers to the data. Therefore two views are considered to be equivalent if they refer to the same implementation data. Otherwise it is not specified whether one record is ordered before the other until the predicate is applied. Note that the ordering may change every time the application runs.
This kind of ordering may be useful if log records are to be stored in an associative container with as least performance overhead as possible, when the particular order is not important.
The FunT
template argument is the predicate that is used to actually compare pointers. It should be able to compare const void*
pointers. The compared pointers may refer to distinct memory regions, the pointers must not be interpreted in any way.