* mln/core/concept/pseudo_site.hh
(change_target(Pseudo_Site<P>&, const typename P::target_t&)):
Remove useless declaration.
Wrap long lines.
* mln/core/internal/site_set_iterator_base.hh
(mln::internal::site_set_iterator_base<S, E>::change_target_):
New method.
Call its exact version...
(mln::internal::site_set_iterator_base<S, E>::change_target):
...here.
---
milena/ChangeLog | 15 +++++++++++++++
milena/mln/core/concept/pseudo_site.hh | 15 ++++++++-------
milena/mln/core/internal/site_set_iterator_base.hh | 17 ++++++++++++++++-
3 files changed, 39 insertions(+), 8 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 4215c0c..5da882c 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,20 @@
2009-09-29 Roland Levillain <roland(a)lrde.epita.fr>
+ Allow iterators to perform extra work while changing their target.
+
+ * mln/core/concept/pseudo_site.hh
+ (change_target(Pseudo_Site<P>&, const typename P::target_t&)):
+ Remove useless declaration.
+ Wrap long lines.
+ * mln/core/internal/site_set_iterator_base.hh
+ (mln::internal::site_set_iterator_base<S, E>::change_target_):
+ New method.
+ Call its exact version...
+ (mln::internal::site_set_iterator_base<S, E>::change_target):
+ ...here.
+
+2009-09-29 Roland Levillain <roland(a)lrde.epita.fr>
+
Work around std::vector<bool> specialization in mln::complex_image.
* mln/core/image/complex_image.hh
diff --git a/milena/mln/core/concept/pseudo_site.hh
b/milena/mln/core/concept/pseudo_site.hh
index 302e152..e8e5b03 100644
--- a/milena/mln/core/concept/pseudo_site.hh
+++ b/milena/mln/core/concept/pseudo_site.hh
@@ -79,10 +79,9 @@ namespace mln
namespace if_possible
{
- // Nota: This procedure is used in internal::site_iterator_base.
-
- template <typename P>
- void change_target(Pseudo_Site<P>& p, const typename P::target_t&
new_target);
+ // Nota: This procedure is used in
+ // internal::site_set_iterator_base and
+ // site_relative_iterator_base.
template <typename O, typename T>
void change_target(Object<O>&, const T&);
@@ -125,9 +124,10 @@ namespace mln
template <>
struct helper< /* is an Object */ true >
{
-
+
template <typename P>
- void change_target(Pseudo_Site<P>& p, const mln_target(P)& new_target)
const
+ void change_target(Pseudo_Site<P>& p,
+ const mln_target(P)& new_target) const
{
exact(p).change_target(new_target);
}
@@ -157,7 +157,8 @@ namespace mln
void change_target(O& o, const D& d)
{
enum { is_object = mlc_is_a(O, Object)::value };
- mln::if_possible::internal::helper< is_object >().change_target(exact(o),
d);
+ mln::if_possible::internal::helper< is_object >().change_target(exact(o),
+ d);
}
} // end of namespace mln::if_possible
diff --git a/milena/mln/core/internal/site_set_iterator_base.hh
b/milena/mln/core/internal/site_set_iterator_base.hh
index 8109f0d..66c94d5 100644
--- a/milena/mln/core/internal/site_set_iterator_base.hh
+++ b/milena/mln/core/internal/site_set_iterator_base.hh
@@ -45,7 +45,8 @@ namespace mln
/// Parameter \c S is the targeted site set type.
///
/// IMPORTANT: Sub-classes have to define start_, next_,
- /// is_valid_ and invalidate_.
+ /// is_valid_ and invalidate_. They may also define
+ /// change_target_.
//
template <typename S, typename E>
class site_set_iterator_base : public site_iterator_base<S, E>
@@ -64,6 +65,10 @@ namespace mln
/// Change the site set targeted by this iterator.
void change_target(const S& s);
+ /// Part of the change_target specific to the exact iterator
+ /// type, empty by default (to be overloaded).
+ void change_target_(const S& s);
+
protected:
/// The psite designated by this iterator.
@@ -100,12 +105,22 @@ namespace mln
// p might be also updated since it can hold a pointer towards
// the set it designates, so:
if_possible::change_target(p_, s);
+ // Likewise, the iterator might need to update specific data.
+ exact(this)->change_target_(s);
// Last:
this->invalidate();
}
template <typename S, typename E>
inline
+ void
+ site_set_iterator_base<S, E>::change_target_(const S& /* s */)
+ {
+ // Empty by default.
+ }
+
+ template <typename S, typename E>
+ inline
const mln_psite(S)&
site_set_iterator_base<S, E>::p_hook_() const
{
--
1.6.3.1
Show replies by date