// boost heap // // Copyright (C) 2010-2011 Tim Blechmann // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_HEAP_POLICIES_HPP #define BOOST_HEAP_POLICIES_HPP #include #include #include #include #include #ifdef BOOST_HAS_PRAGMA_ONCE #pragma once #endif namespace boost { namespace heap { #ifndef BOOST_DOXYGEN_INVOKED BOOST_PARAMETER_TEMPLATE_KEYWORD(allocator) BOOST_PARAMETER_TEMPLATE_KEYWORD(compare) namespace tag { struct stable; } template struct stable: boost::parameter::template_keyword > {}; namespace tag { struct mutable_; } template struct mutable_: boost::parameter::template_keyword > {}; namespace tag { struct constant_time_size; } template struct constant_time_size: boost::parameter::template_keyword > {}; namespace tag { struct store_parent_pointer; } template struct store_parent_pointer: boost::parameter::template_keyword > {}; namespace tag { struct arity; } template struct arity: boost::parameter::template_keyword > {}; namespace tag { struct objects_per_page; } template struct objects_per_page: boost::parameter::template_keyword > {}; BOOST_PARAMETER_TEMPLATE_KEYWORD(stability_counter_type) namespace detail { namespace mpl = boost::mpl; template struct has_arg { typedef typename boost::parameter::binding::type type; static const bool value = mpl::is_not_void_::type::value; }; template struct extract_stable { static const bool has_stable = has_arg::value; typedef typename mpl::if_c::type, mpl::bool_ >::type stable_t; static const bool value = stable_t::value; }; template struct extract_mutable { static const bool has_mutable = has_arg::value; typedef typename mpl::if_c::type, mpl::bool_ >::type mutable_t; static const bool value = mutable_t::value; }; } #else /** \brief Specifies the predicate for the heap order */ template struct compare{}; /** \brief Configure heap as mutable * * Certain heaps need to be configured specifically do be mutable. * * */ template struct mutable_{}; /** \brief Specifies allocator for the internal memory management */ template struct allocator{}; /** \brief Configure a heap as \b stable * * A priority queue is stable, if elements with the same priority are popped from the heap, in the same order as * they are inserted. * */ template struct stable{}; /** \brief Specifies the type for stability counter * * */ template struct stability_counter_type{}; /** \brief Configures complexity of size() * * Specifies, whether size() should have linear or constant complexity. * */ template struct constant_time_size{}; /** \brief Store parent pointer in heap node. * * Maintaining a parent pointer adds some maintenance and size overhead, but iterating a heap is more efficient. * */ template struct store_parent_pointer{}; /** \brief Specify arity. * * Specifies the arity of a D-ary heap * */ template struct arity{}; #endif } /* namespace heap */ } /* namespace boost */ #endif /* BOOST_HEAP_POLICIES_HPP */