27 #ifndef MLN_CORE_INTERNAL_SET_OF_HH
28 # define MLN_CORE_INTERNAL_SET_OF_HH
39 # include <mln/core/contract.hh>
40 # include <mln/core/internal/force_exact.hh>
97 const E&
element(
unsigned i)
const;
111 bool has(
const E& elt)
const;
135 const std::vector<E>&
vect()
const;
149 mutable std::vector<E> v_;
163 void update_()
const;
166 mutable bool needs_update_;
186 # ifndef MLN_INCLUDE_ONLY
188 template <
typename E>
192 needs_update_ =
false;
195 template <
typename E>
201 if (needs_update_ ==
false)
202 needs_update_ =
true;
203 return internal::force_exact< set_of_<E> >(*this);
206 template <
typename E>
212 if (needs_update_ ==
false)
213 needs_update_ =
true;
214 return internal::force_exact< set_of_<E> >(*this);
217 template <
typename E>
224 mln_precondition(i < v_.size());
228 template <
typename E>
238 template <
typename E>
243 return s_.find(elt) != s_.end();
246 template <
typename E>
254 template <
typename E>
261 needs_update_ =
false;
262 mln_postcondition(is_empty());
265 template <
typename E>
267 const std::vector<E>&
275 template <
typename E>
278 set_of_<E>::update_()
const
280 mln_precondition(needs_update_);
282 std::copy(s_.begin(), s_.end(), std::back_inserter(v_));
286 needs_update_ =
false;
302 # endif // ! MLN_INCLUDE_ONLY
309 #endif // ! MLN_CORE_INTERNAL_SET_OF_HH