1 // boost heap: concepts
3 // Copyright (C) 2010 Tim Blechmann
5 // Distributed under the Boost Software License, Version 1.0. (See
6 // accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 #ifndef BOOST_HEAP_CONCEPTS_HPP
10 #define BOOST_HEAP_CONCEPTS_HPP
12 #include <boost/concept_check.hpp>
20 boost::ForwardContainer<C>
22 typedef typename C::iterator iterator;
23 typedef typename C::const_iterator const_iterator;
24 typedef typename C::allocator_type allocator_type;
25 typedef typename C::value_compare value_compare;
26 typedef typename C::value_type value_type;
27 typedef typename C::const_reference const_reference;
30 BOOST_CONCEPT_USAGE(PriorityQueue)
32 BOOST_CONCEPT_ASSERT((boost::Assignable<value_type>));
33 BOOST_CONCEPT_ASSERT((boost::Container<C>));
34 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<C>));
35 BOOST_CONCEPT_ASSERT((boost::Comparable<C>));
37 BOOST_CONCEPT_ASSERT((boost::Const_BinaryPredicate<value_compare, value_type, value_type>));
41 a = c.get_allocator();
43 typename PriorityQueue::value_type v;
52 has_ordered_iterators = C::has_ordered_iterators;
53 is_mergable = C::is_mergable;
54 is_stable = C::is_stable;
60 typename C::value_type v;
62 bool has_ordered_iterators, is_mergable, is_stable;
66 struct MergablePriorityQueue:
69 BOOST_CONCEPT_USAGE(MergablePriorityQueue)
78 struct MutablePriorityQueue:
81 typedef typename C::handle_type handle_type;
83 BOOST_CONCEPT_USAGE(MutablePriorityQueue)
85 BOOST_CONCEPT_ASSERT((boost::Assignable<typename MutablePriorityQueue::handle_type>));
87 typename MutablePriorityQueue::value_type v;
88 typename MutablePriorityQueue::handle_type h = c.push(v);
89 typename MutablePriorityQueue::handle_type h2 = c.push(v);
99 not_equal = (h != h2);
105 bool equal, not_equal;
110 #endif /* BOOST_HEAP_CONCEPTS_HPP */