26 #ifndef MLN_CORE_SITE_SET_P_QUEUE_FAST_HH
27 # define MLN_CORE_SITE_SET_P_QUEUE_FAST_HH
36 # include <mln/core/site_set/p_array.hh>
43 template <
typename P>
class p_queue_fast;
51 struct site_set_< p_queue_fast<P> >
53 typedef trait::site_set::nsites::known
nsites;
54 typedef trait::site_set::bbox::unknown bbox;
55 typedef trait::site_set::contents::growing contents;
56 typedef trait::site_set::arity::multiple arity;
72 class p_queue_fast :
public internal::site_set_base_< P, p_queue_fast<P> >
97 void reserve(
typename p_array<P>::size_type n);
103 bool has(
const util::index& i)
const;
118 void push(
const P& p);
133 const P&
front()
const;
166 # ifndef MLN_INCLUDE_ONLY
168 template <
typename P>
176 template <
typename P>
184 template <
typename P>
189 std::vector<P>& v = q_.hook_std_vector_();
190 std::copy(v.begin() + begin_,
193 v.resize(end_ - begin_);
198 template <
typename P>
203 mln_precondition(p.target_() ==
this);
204 if (p.index() < 0 || unsigned(p.index()) >= nsites())
211 template <
typename P>
216 return i >= 0 && unsigned(i) < nsites();
219 template <
typename P>
224 for (
unsigned i = begin_; i < end_; ++i)
230 template <
typename P>
238 template <
typename P>
243 mln_invariant(end_ >= begin_);
244 return end_ - begin_;
247 template <
typename P>
252 mln_invariant(end_ >= begin_);
253 return end_ == begin_;
256 template <
typename P>
265 template <
typename P>
270 mln_precondition(! this->is_empty());
274 template <
typename P>
279 mln_precondition(! this->is_empty());
283 template <
typename P>
288 mln_precondition(! this->is_empty());
289 const P& res = this->front();
294 template <
typename P>
302 template <
typename P>
307 mln_precondition(i < nsites());
308 return q_[begin_ + i];
311 template <
typename P>
319 template <
typename P>
321 const std::vector<P>&
324 return q_.std_vector();
327 template <
typename P>
332 return q_.memory_size() + 2 *
sizeof(unsigned);
335 # endif // ! MLN_INCLUDE_ONLY
340 #endif // ! MLN_CORE_SITE_SET_P_QUEUE_FAST_HH