17 #ifndef BOOST_CONTAINER_PRIORITY_DEQUE_HPP_
18 #define BOOST_CONTAINER_PRIORITY_DEQUE_HPP_
21 #error priority_deque.hpp requires a C++ compiler.
29 #if (__cplusplus >= 201103L)
36 #ifdef BOOST_ASSERT_MSG
37 #define BOOST_CONTAINER_PRIORITY_DEQUE_ASSERT(x,m) BOOST_ASSERT_MSG(x,m)
39 #define BOOST_CONTAINER_PRIORITY_DEQUE_ASSERT(x,m) assert(x)
41 #define BOOST_CONTAINER_PRIORITY_DEQUE_ASSERT(x,m)
47 template <
typename Type,
typename Sequence =std::vector<Type>,
48 typename Compare =::std::less<
typename Sequence::value_type> >
52 template <
typename Type,
typename Sequence,
typename Compare>
90 template <
typename Type,
typename Sequence,
typename Compare>
104 typedef typename container_type::pointer
pointer;
113 #if (__cplusplus >= 201103L)
115 Sequence&& =Sequence());
120 const Sequence& =Sequence());
122 #if (__cplusplus >= 201103L)
124 template <
typename InputIterator>
126 const Compare& =Compare(),
127 Sequence&& =Sequence());
129 template <
typename InputIterator>
131 const Compare&,
const Sequence&);
133 template <
typename InputIterator>
135 const Compare& =Compare(),
136 const Sequence& =Sequence());
141 #if (__cplusplus >= 201103L)
145 template<
typename... Args>
146 void emplace (Args&&...);
169 inline bool empty (
void)
const {
return sequence_.empty();};
174 return sequence_.max_size();
180 inline void clear (
void) { sequence_.clear(); };
185 template <
typename InputIterator>
186 void merge (InputIterator first, InputIterator last);
188 template <
typename SourceContainer>
189 inline void merge (
const SourceContainer& source) {
190 merge(source.begin(), source.end());
202 #if (__cplusplus >= 201103L)
242 template <
typename T,
typename S,
typename C>
244 : sequence_(seq), compare_(comp)
248 #if (__cplusplus >= 201103L)
249 template <
typename T,
typename S,
typename C>
251 : sequence_(std::move(seq)), compare_(comp)
266 template <
typename T,
typename S,
typename C>
267 template <
typename InputIterator>
269 const C& comp,
const S& seq)
270 : sequence_(seq), compare_(comp)
273 sequence_.insert(sequence_.end(), first, last);
280 #if (__cplusplus >= 201103L)
281 template <
typename T,
typename S,
typename C>
282 template <
typename InputIterator>
284 const C& comp, S&& seq)
285 : sequence_(std::move(seq)), compare_(comp)
288 sequence_.insert(sequence_.end(), first, last);
305 template <
typename T,
typename Sequence,
typename Compare>
308 sequence_.push_back(value);
315 #if (__cplusplus >= 201103L)
316 template <
typename T,
typename Sequence,
typename Compare>
319 sequence_.push_back(std::move(value));
327 template <
typename T,
typename Sequence,
typename Compare>
328 template<
typename... Args>
329 void priority_deque<T, Sequence, Compare>::emplace (Args&&... args) {
331 sequence_.emplace_back(std::forward<Args>(args)...);
347 template <
typename T,
typename Sequence,
typename Compare>
348 inline typename priority_deque<T, Sequence, Compare>::const_reference
352 "Empty priority deque has no maximal element. Reference undefined.");
354 return (it == sequence_.end()) ? sequence_.front() : *it;
362 template <
typename T,
typename Sequence,
typename Compare>
367 "Empty priority deque has no minimal element. Reference undefined.");
368 return sequence_.front();
378 template <
typename T,
typename Sequence,
typename Compare>
381 "Empty priority deque has no maximal element. Removal impossible.");
384 sequence_.pop_back();
398 template <
typename T,
typename Sequence,
typename Compare>
401 "Empty priority deque has no minimal element. Removal undefined.");
404 sequence_.pop_back();
422 template <
typename T,
typename S,
typename C>
423 template <
typename InputIterator>
426 sequence_.insert(sequence_.end(), first, last);
442 template <
typename T,
typename S,
typename C>
444 sequence_.swap(other.sequence_);
455 template <
typename T,
typename S,
typename C>
475 template <
typename T,
typename S,
typename C>
481 (index < end() -
begin()),
"Iterator out of bounds; can't set element.");
483 *(sequence_.begin() + index) = value;
486 #if (__cplusplus >= 201103L)
487 template <
typename T,
typename S,
typename C>
491 const difference_type index = random_it -
begin();
493 (index < end() -
begin()),
"Iterator out of bounds; can't set element.");
495 *(sequence_.begin() + index) = std::move(value);
507 template <
typename T,
typename Sequence,
typename Compare>
511 (index < end() -
begin()),
"Iterator out of bounds; can't erase element.");
514 sequence_.pop_back();