* mln/topo/face.hh
(mln::topo::face<D>::lower_dim_adj_faces):
Return an empty vector if `this' is a 0-face.
(mln::topo::face<D>::higher_dim_adj_faces):
Return an empty vector if `this' is a D-face.
(mln::topo::face<D>::lower_dim_adj_faces)
(mln::topo::face<D>::higher_dim_adj_faces):
Make it const.
(mln::topo::internal::lower_dim_adj_faces_if_dim_matches_<N, D>)
(mln::topo::internal::higher_dim_adj_faces_if_dim_matches_<N, D>):
Adjust.
---
milena/ChangeLog | 16 ++++++++++++++++
milena/mln/topo/face.hh | 26 ++++++++++++++------------
2 files changed, 30 insertions(+), 12 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index d820e59..6ce4fb0 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,21 @@
2008-09-30 Roland Levillain <roland(a)lrde.epita.fr>
+ Improve accesses to adjacent faces to mln::topo::face<D>.
+
+ * mln/topo/face.hh
+ (mln::topo::face<D>::lower_dim_adj_faces):
+ Return an empty vector if `this' is a 0-face.
+ (mln::topo::face<D>::higher_dim_adj_faces):
+ Return an empty vector if `this' is a D-face.
+ (mln::topo::face<D>::lower_dim_adj_faces)
+ (mln::topo::face<D>::higher_dim_adj_faces):
+ Make it const.
+ (mln::topo::internal::lower_dim_adj_faces_if_dim_matches_<N, D>)
+ (mln::topo::internal::higher_dim_adj_faces_if_dim_matches_<N, D>):
+ Adjust.
+
+2008-09-30 Roland Levillain <roland(a)lrde.epita.fr>
+
Delegate pretty-printing of iterators on faces to mln::topo::face.
* mln/topo/internal/complex_iter_base.hh (operator<<): Here.
diff --git a/milena/mln/topo/face.hh b/milena/mln/topo/face.hh
index c485697..1ff81e5 100644
--- a/milena/mln/topo/face.hh
+++ b/milena/mln/topo/face.hh
@@ -100,9 +100,9 @@ namespace mln
// FIXME: To be overhauled.
// FIXME: Why no `const' here?
/// Return an array of face handles pointing to adjacent (n-1)-faces.
- std::vector< face<D> > lower_dim_adj_faces();
+ std::vector< face<D> > lower_dim_adj_faces() const;
/// Return an array of face handles pointing to adjacent (n+1)-faces.
- std::vector< face<D> > higher_dim_adj_faces();
+ std::vector< face<D> > higher_dim_adj_faces() const;
/// \}
private:
@@ -264,7 +264,7 @@ namespace mln
template <unsigned N, unsigned D>
struct lower_dim_adj_faces_if_dim_matches_
{
- std::vector< face<D> > operator()(face<D>& face)
+ std::vector< face<D> > operator()(const face<D>& face)
{
metal::bool_< (N <= D) >::check();
metal::bool_< (N > 1) >::check();
@@ -288,7 +288,7 @@ namespace mln
template <unsigned D>
struct lower_dim_adj_faces_if_dim_matches_<1, D>
{
- std::vector< face<D> > operator()(face<D>& face)
+ std::vector< face<D> > operator()(const face<D>& face)
{
/// If we reached this function, then the dimension of FACE
/// has to be 1.
@@ -306,7 +306,7 @@ namespace mln
template <unsigned N, unsigned D>
struct higher_dim_adj_faces_if_dim_matches_
{
- std::vector< face<D> > operator()(face<D>& face)
+ std::vector< face<D> > operator()(const face<D>& face)
{
metal::bool_< (N < D) >::check();
@@ -330,7 +330,7 @@ namespace mln
template <unsigned D>
struct higher_dim_adj_faces_if_dim_matches_<0, D>
{
- std::vector< face<D> > operator()(face<D>& face)
+ std::vector< face<D> > operator()(const face<D>& face)
{
/// If we reached this function, then the dimension of face
/// has to be D - 1.
@@ -350,25 +350,27 @@ namespace mln
template <unsigned D>
inline
std::vector< face<D> >
- face<D>::lower_dim_adj_faces()
+ face<D>::lower_dim_adj_faces() const
{
// FIXME: Warning: might prevent any attempt to build a complex<0>.
metal::bool_< D != 0 >::check();
- mln_precondition(n_ > 0);
- return internal::lower_dim_adj_faces_if_dim_matches_<D, D>()(*this);
+ return n_ > 0 ?
+ internal::lower_dim_adj_faces_if_dim_matches_<D, D>()(*this) :
+ std::vector< face<D> >();
}
template <unsigned D>
inline
std::vector< face<D> >
- face<D>::higher_dim_adj_faces()
+ face<D>::higher_dim_adj_faces() const
{
// FIXME: Warning: might prevent any attempt to build a complex<0>.
metal::bool_< D != 0 >::check();
- mln_precondition(n_ < D);
- return internal::higher_dim_adj_faces_if_dim_matches_<D - 1, D>()(*this);
+ return n_ < D ?
+ internal::higher_dim_adj_faces_if_dim_matches_<D - 1, D>()(*this) :
+ std::vector< face<D> >();
}
--
1.6.0.1
Show replies by date