* mln/topo/face.hh (operator< (const face<D>&, const face<D>&)):
Here.
This way, a standard container relying on operator< can accept
faces of different dimensions.
---
milena/ChangeLog | 9 +++++++++
milena/mln/topo/face.hh | 5 ++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index d49139e..ce5e952 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,14 @@
2009-04-06 Roland Levillain <roland(a)lrde.epita.fr>
+ Allow the comparison of faces of different dimensions using `<'.
+
+ * mln/topo/face.hh (operator< (const face<D>&, const face<D>&)):
+ Here.
+ This way, a standard container relying on operator< can accept
+ faces of different dimensions.
+
+2009-04-06 Roland Levillain <roland(a)lrde.epita.fr>
+
Add some simple triangle meshes.
* mesh/one-triangle.off:
diff --git a/milena/mln/topo/face.hh b/milena/mln/topo/face.hh
index 74077f1..9c9872f 100644
--- a/milena/mln/topo/face.hh
+++ b/milena/mln/topo/face.hh
@@ -405,9 +405,8 @@ namespace mln
{
// Ensure LHS and RHS belong to the same complex.
mln_precondition(lhs.cplx() == rhs.cplx());
- // Ensure LHS and RHS have the same dimension.
- mln_precondition(lhs.n() == rhs.n());
- return lhs.face_id() < rhs.face_id();
+ return lhs.n() < rhs.n() ||
+ (lhs.n() == rhs.n() && lhs.face_id() < rhs.face_id());
}
--
1.6.1.2