2632: Enrich the interface of mln::util::multi_site.

* mln/util/multi_site.hh (mln::util::multi_site<P>::front): New methods. --- milena/ChangeLog | 7 +++++++ milena/mln/util/multi_site.hh | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+), 0 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index eb646f2..cfd2a4f 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -24,6 +24,13 @@ 2008-10-22 Roland Levillain <roland@lrde.epita.fr> + Enrich the interface of mln::util::multi_site. + + * mln/util/multi_site.hh (mln::util::multi_site<P>::front): + New methods. + +2008-10-22 Roland Levillain <roland@lrde.epita.fr> + Add window on transitively adjacent m-faces. * mln/core/image/complex_windows.hh diff --git a/milena/mln/util/multi_site.hh b/milena/mln/util/multi_site.hh index b7bedae..6eb046d 100644 --- a/milena/mln/util/multi_site.hh +++ b/milena/mln/util/multi_site.hh @@ -59,10 +59,16 @@ namespace mln /// Interface similar to std::vector. /// \{ void push_back(const P& p); + void reserve(size_type n); + size_type size() const; + reference operator[](size_type n); const_reference operator[](size_type n) const; + + const_reference front() const; + reference front(); /// \} container sites; @@ -107,6 +113,22 @@ namespace mln return sites[n]; } + template <typename P> + typename multi_site<P>::const_reference + multi_site<P>::front() const + { + mln_precondition(!sites.empty()); + return sites[0]; + } + + template <typename P> + typename multi_site<P>::reference + multi_site<P>::front() + { + mln_precondition(!sites.empty()); + return sites[0]; + } + # endif // ! MLN_INCLUDE_ONLY } // end of mln::util -- 1.6.0.1
participants (1)
-
Roland Levillain