[PATCH 14/22] Add a dummy operator< to mln::util::multi_site<P>.

* mln/util/multi_site.hh (operator< (const multi_site<P>& lhs, const multi_site<P>& rhs)): New. --- milena/ChangeLog | 8 ++++++++ milena/mln/util/multi_site.hh | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+), 0 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index c90e910..fd80747 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,13 @@ 2009-09-29 Roland Levillain <roland@lrde.epita.fr> + Add a dummy operator< to mln::util::multi_site<P>. + + * mln/util/multi_site.hh + (operator< (const multi_site<P>& lhs, const multi_site<P>& rhs)): + New. + +2009-09-29 Roland Levillain <roland@lrde.epita.fr> + Have mln::topo::is_n_face<B> expose a more tolerant interface. * mln/topo/is_n_face.hh diff --git a/milena/mln/util/multi_site.hh b/milena/mln/util/multi_site.hh index 220308d..6011e91 100644 --- a/milena/mln/util/multi_site.hh +++ b/milena/mln/util/multi_site.hh @@ -31,10 +31,14 @@ # include <cstddef> +# include <algorithm> # include <vector> # include <mln/core/concept/object.hh> +# include <mln/util/ord.hh> + + namespace mln { @@ -80,6 +84,12 @@ namespace mln bool operator==(const multi_site<P>& lhs, const multi_site<P>& rhs); + /* FIXME: Required (indirectly) by a postcondition in + mln::morpho::dilation. */ + template <typename P> + bool + operator< (const multi_site<P>& lhs, const multi_site<P>& rhs); + # ifndef MLN_INCLUDE_ONLY @@ -143,6 +153,17 @@ namespace mln return lhs.sites == rhs.sites; } + template <typename P> + bool + operator< (const multi_site<P>& lhs, const multi_site<P>& rhs) + { + // FIXME: This comparison is meaningless, since LHS and RHS are + // not sorted! + return std::lexicographical_compare(lhs.sites.begin(), lhs.sites.end(), + rhs.sites.begin(), rhs.sites.end(), + util::ord<P>()); + } + # endif // ! MLN_INCLUDE_ONLY } // end of mln::util -- 1.6.3.1
participants (1)
-
Roland Levillain