Использование binomial_heap с косвенным_cmp

Я пытаюсь сохранить кучу отсортированных по значениям в карте свойств. Я старался
код ниже, но компилятору не нравятся мои аргументы
конструктор кучи (PriorityQueueType pq (косвенное сравнение);).
Согласно документации
(Http://www.boost.org/doc/libs/1_51_0/doc/html/boost/heap/binomial_heap.html),
есть конструктор:

явный binomial_heap (value_compare const & = value_compare ());

который принимает значение value_compare, которое я думал бы типа
IndirectComparisonType, который я предоставил (я не очень понимаю
необязательные аргументы шаблона и тип base_maker :: compare_argument
вещей)?

Вот справочный документirect_cmp для справки:
http://www.boost.org/doc/libs/1_51_0/boost/pending/indirect_cmp.hpp

#include <boost/heap/binomial_heap.hpp>
#include <boost/pending/indirect_cmp.hpp>
#include <boost/array.hpp>
#include <boost/graph/grid_graph.hpp>
#include <iostream>

int main(int, char*[])
{
// Construct a graph
boost::array<std::size_t, 2> lengths = { { 2,2 } };
typedef boost::grid_graph<2> GraphType;
GraphType graph(lengths);
typedef boost::graph_traits<GraphType>::vertex_descriptor Vertex;
typedef boost::property_map<GraphType,
boost::vertex_index_t>::const_type GridIndexMapType;
GridIndexMapType gridIndexMap(get(boost::vertex_index, graph));

// Construct a property map
typedef boost::vector_property_map<float, GridIndexMapType> PriorityMapType;
PriorityMapType priorityMap(gridIndexMap);

// Construct the indirect comparison functor
typedef boost::indirect_cmp<PriorityMapType, std::less<float> >
IndirectComparisonType;
IndirectComparisonType indirectComparison(priorityMap);

// Construct the queue
typedef int ValueType;
typedef boost::heap::binomial_heap<ValueType,
boost::heap::stable<false>, IndirectComparisonType> PriorityQueueType;
PriorityQueueType pq(indirectComparison);

return 0;
}

Кто-нибудь знает, как предоставить этот косвенный функтор сравнения
очередь правильно?

1

Решение

Вам нужно окружить опцию шаблона boost::heap::compare идентифицировать его как таковой, как указано в документах.

0

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector