26 #ifndef MLN_UTIL_MULTI_SITE_HH
27 # define MLN_UTIL_MULTI_SITE_HH
37 # include <mln/core/concept/object.hh>
39 # include <mln/util/ord.hh>
49 struct multi_site :
public mln::Object< multi_site<P> >
55 typedef mln_coord(P) coord;
57 typedef std::vector<P> container;
58 typedef typename container::size_type size_type;
59 typedef typename container::reference reference;
60 typedef typename container::const_reference const_reference;
64 void push_back(const P& p);
66 void reserve(size_type n);
68 size_type size() const;
70 reference operator[](size_type n);
71 const_reference operator[](size_type n) const;
73 const_reference front() const;
85 operator==(const multi_site<P>& lhs, const multi_site<P>& rhs);
91 operator< (const multi_site<P>& lhs, const multi_site<P>& rhs);
95 # ifndef MLN_INCLUDE_ONLY
99 multi_site<P>::push_back(
const P& p)
104 template <
typename P>
106 multi_site<P>::reserve(size_type n)
111 template <
typename P>
112 typename multi_site<P>::size_type
113 multi_site<P>::size()
const
118 template <
typename P>
119 typename multi_site<P>::reference
120 multi_site<P>::operator[](size_type n)
125 template <
typename P>
126 typename multi_site<P>::const_reference
127 multi_site<P>::operator[](size_type n)
const
132 template <
typename P>
133 typename multi_site<P>::const_reference
134 multi_site<P>::front()
const
136 mln_precondition(!sites.empty());
140 template <
typename P>
141 typename multi_site<P>::reference
142 multi_site<P>::front()
144 mln_precondition(!sites.empty());
149 template <
typename P>
151 operator==(
const multi_site<P>& lhs,
const multi_site<P>& rhs)
153 return lhs.sites == rhs.sites;
156 template <
typename P>
158 operator< (const multi_site<P>& lhs,
const multi_site<P>& rhs)
162 return std::lexicographical_compare(lhs.sites.begin(), lhs.sites.end(),
163 rhs.sites.begin(), rhs.sites.end(),
167 # endif // ! MLN_INCLUDE_ONLY
174 #endif // ! MLN_UTIL_MULTI_SITE_HH