Trying to follow the boost docs on the usage of this, but am running into a snag.
Building on CentOS 7, g++ 4.8.5-28. Language standard: C++03
Working sample: https://godbolt.org/z/KPvjS_
My Code:
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/sequenced_index.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/identity.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/composite_key.hpp>
using namespace ::boost;
using namespace ::boost::multi_index;
typedef unsigned char UInt8;
typedef unsigned int UInt32;
typedef UInt8 ACCESSID[16];
class AccessID
{
public:
AccessID();
AccessID(const AccessID & id);
const std::size_t GetHash() const { return hashId;}
private:
ACCESSID id;
std::size_t hashId;
};
struct map_entry
{
UInt32 subject_hash;
UInt32 container;
AccessID clientAccessId;
AccessID serverAccessId;
map_entry( UInt32 parmHash
, UInt32 parmContainer
, AccessID &parmClientAccessId
, AccessID &parmServerAccessId )
: subject_hash( parmHash )
, container( parmContainer )
, clientAccessId( parmClientAccessId )
, serverAccessId( parmServerAccessId )
{
}
};
struct clientAccessId_extractor
{
typedef std::size_t result_type;
result_type operator ()( const map_entry &e ) const
{
// Hash is a boost::hash value.
return e.clientAccessId.GetHash();
}
};
struct serverAccessId_extractor
{
typedef std::size_t result_type;
result_type operator ()( const map_entry &e ) const
{
return e.serverAccessId.GetHash();
}
};
// Define the mapping relationships; like a "database" of sorts.
typedef multi_index_container<
map_entry,
indexed_by<
// Former "global" view.
ordered_unique<
composite_key<
map_entry,
member< map_entry, UInt32, &map_entry::container >,
serverAccessId_extractor
>
>,
// Regular lookup.
ordered_unique<
composite_key<
map_entry,
member< map_entry, UInt32, &map_entry::subject_hash >,
member< map_entry, UInt32, &map_entry::container >,
clientAccessId_extractor
>
>
>
> mapDb_t;
// Typedef the index types for easier reading.
typedef mapDb_t::nth_index< 0 >::type mapDb_by_serverAid;
typedef mapDb_t::nth_index< 1 >::type mapDb_by_clientAid;
class MappingClass
{
private:
// Index views.
mapDb_by_serverAid serverView;
mapDb_by_clientAid clientView;
// Index iterators.
mapDb_by_clientAid::iterator clientIter;
mapDb_by_serverAid::iterator serverIter;
// Define an object of the mapping db type.
mapDb_t mapDb;
public:
MappingClass() { };
~MappingClass() { };
};
And the error output from trying to compile:
$ g++ -fPIC -x c++ -c -Wno-unused-local-typedefs -Wall -Werror -O2 -m64 -D__EXTENSIONS__ -U_RWSTD_MULTI_THREAD -U_REENTRANT -DUSE_PTHREADS -DNDEBUG -DGCCBOOL -U_THREAD_SAFE -I/home/jearle/git//Open-Source/boost/1.51.0/common test_mi2.cpp -o test_mi2.o
test_mi2.cpp: In constructor ‘MappingClass::MappingClass()’:
test_mi2.cpp:110:20: error: no matching function for call to ‘boost::multi_index::detail::ordered_index<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor>, std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> > >, boost::multi_index::detail::nth_layer<1, map_entry, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> >, boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, std::allocator<map_entry> >, boost::mpl::vector0<mpl_::na>, boost::multi_index::detail::ordered_unique_tag>::ordered_index( ’
MappingClass() { };
^
test_mi2.cpp:110:20: note: candidates are:
In file included from test_mi2.cpp:3:0:
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:542:3: note: boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::ordered_index(const boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>&) [with KeyFromValue = boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor>; Compare = std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> > >; SuperMeta = boost::multi_index::detail::nth_layer<1, map_entry, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> >, boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, std::allocator<map_entry> >; TagList = boost::mpl::vector0<mpl_::na>; Category = boost::multi_index::detail::ordered_unique_tag]
ordered_index(
^
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:542:3: note: candidate expects 1 argument, 0 provided
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:534:3: note: boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::ordered_index(const ctor_args_list&, const allocator_type&) [with KeyFromValue = boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor>; Compare = std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> > >; SuperMeta = boost::multi_index::detail::nth_layer<1, map_entry, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> >, boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, std::allocator<map_entry> >; TagList = boost::mpl::vector0<mpl_::na>; Category = boost::multi_index::detail::ordered_unique_tag; boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::ctor_args_list = boost::tuples::cons<boost::tuples::tuple<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor>, std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> > >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type>, boost::tuples::cons<boost::tuples::tuple<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor>, std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type>, boost::tuples::null_type> >; typename SuperMeta::type::ctor_args_list = boost::tuples::cons<boost::tuples::tuple<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor>, std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type>, boost::tuples::null_type>; boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::allocator_type = std::allocator<map_entry>]
ordered_index(const ctor_args_list& args_list,const allocator_type& al):
^
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:534:3: note: candidate expects 2 arguments, 0 provided
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:558:3: error: ‘boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::~ordered_index() [with KeyFromValue = boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor>; Compare = std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> > >; SuperMeta = boost::multi_index::detail::nth_layer<1, map_entry, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> >, boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, std::allocator<map_entry> >; TagList = boost::mpl::vector0<mpl_::na>; Category = boost::multi_index::detail::ordered_unique_tag]’ is protected
~ordered_index()
^
test_mi2.cpp:110:20: error: within this context
MappingClass() { };
^
test_mi2.cpp:110:20: error: no matching function for call to ‘boost::multi_index::detail::ordered_index<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor>, std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, boost::multi_index::detail::nth_layer<2, map_entry, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> >, boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, std::allocator<map_entry> >, boost::mpl::vector0<mpl_::na>, boost::multi_index::detail::ordered_unique_tag>::ordered_index()’
test_mi2.cpp:110:20: note: candidates are:
In file included from test_mi2.cpp:3:0:
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:542:3: note: boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::ordered_index(const boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>&) [with KeyFromValue = boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor>; Compare = std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >; SuperMeta = boost::multi_index::detail::nth_layer<2, map_entry, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> >, boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, std::allocator<map_entry> >; TagList = boost::mpl::vector0<mpl_::na>; Category = boost::multi_index::detail::ordered_unique_tag]
ordered_index(
^
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:542:3: note: candidate expects 1 argument, 0 provided
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:534:3: note: boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::ordered_index(const ctor_args_list&, const allocator_type&) [with KeyFromValue = boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor>; Compare = std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >; SuperMeta = boost::multi_index::detail::nth_layer<2, map_entry, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> >, boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, std::allocator<map_entry> >; TagList = boost::mpl::vector0<mpl_::na>; Category = boost::multi_index::detail::ordered_unique_tag; boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::ctor_args_list = boost::tuples::cons<boost::tuples::tuple<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor>, std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type>, boost::tuples::null_type>; typename SuperMeta::type::ctor_args_list = boost::tuples::null_type; boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::allocator_type = std::allocator<map_entry>]
ordered_index(const ctor_args_list& args_list,const allocator_type& al):
^
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:534:3: note: candidate expects 2 arguments, 0 provided
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:558:3: error: ‘boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::~ordered_index() [with KeyFromValue = boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor>; Compare = std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >; SuperMeta = boost::multi_index::detail::nth_layer<2, map_entry, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> >, boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, std::allocator<map_entry> >; TagList = boost::mpl::vector0<mpl_::na>; Category = boost::multi_index::detail::ordered_unique_tag]’ is protected
~ordered_index()
^
test_mi2.cpp:110:20: error: within this context
MappingClass() { };
^
In file included from test_mi2.cpp:3:0:
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp: In destructor ‘MappingClass::~MappingClass()’:
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:558:3: error: ‘boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::~ordered_index() [with KeyFromValue = boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor>; Compare = std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> > >; SuperMeta = boost::multi_index::detail::nth_layer<1, map_entry, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> >, boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, std::allocator<map_entry> >; TagList = boost::mpl::vector0<mpl_::na>; Category = boost::multi_index::detail::ordered_unique_tag]’ is protected
~ordered_index()
^
test_mi2.cpp:111:21: error: within this context
~MappingClass() { };
^
In file included from test_mi2.cpp:3:0:
/home/jearle/git//Open-Source/boost/1.51.0/common/boost/multi_index/ordered_index.hpp:558:3: error: ‘boost::multi_index::detail::ordered_index<KeyFromValue, Compare, SuperMeta, TagList, Category>::~ordered_index() [with KeyFromValue = boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor>; Compare = std::less<boost::multi_index::composite_key_result<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >; SuperMeta = boost::multi_index::detail::nth_layer<2, map_entry, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, serverAccessId_extractor> >, boost::multi_index::ordered_unique<boost::multi_index::composite_key<map_entry, boost::multi_index::member<map_entry, unsigned int, &map_entry::subject_hash>, boost::multi_index::member<map_entry, unsigned int, &map_entry::container>, clientAccessId_extractor> > >, std::allocator<map_entry> >; TagList = boost::mpl::vector0<mpl_::na>; Category = boost::multi_index::detail::ordered_unique_tag]’ is protected
~ordered_index()
^
test_mi2.cpp:111:21: error: within this context
~MappingClass() { };
^
I don't really understand what the boost errors are, here. What have I missed?
The map index types are not default constructible, you need to change them to references and initialise them in your constructor:
class MappingClass
{
private:
// Define an object of the mapping db type.
mapDb_t mapDb;
// Index iterators.
mapDb_by_clientAid::iterator clientIter;
mapDb_by_serverAid::iterator serverIter;
// Index views.
mapDb_by_serverAid& serverView;
mapDb_by_clientAid& clientView;
public:
MappingClass()
:serverView( mapDb.get< 0 >() ),
clientView( mapDb.get< 1 >() ) { };
~MappingClass() { };
};
Note you also need to move mapDb to before the views so that it is initialised first.
Related
I am getting a compiler error trying to use boost::interprocess:map and I do not understand the error.
Declaring the map and its allocator
using namespace boost::interprocess;
struct Order {
uint64_t id = 0;
uint64_t val = 0;
};
typedef std::pair<const uint64_t, Order> ValueType;
typedef allocator<ValueType,
managed_shared_memory::segment_manager> OrderMapAllocator;
typedef map<const uint64_t,
Order,
std::less<const uint64_t>,
OrderMapAllocator> OrderMap;
Example usage, the compiler error points out line 120 which is the first line of the function below:
OrderMap * _orders;
void addOrder(Order order) {
if(_orders->find(order.id) != _orders->end()){
/* stuff */
} else {
(*_orders)[order.id] = order;
}
}
Note, I previously ran the code using std::map successfully, with the key non const instead of const. I switched the key to const uint64_t because a type assertion in boost was failing.
Gets the compiler errors below which I cannot interpret
For conciseness, the first one ends:
boost::container::map<Key, T, Compare, Allocator, Options>::nonconst_value_type = std::pair<const long unsigned int, Order>]’ cannot be overloaded
std::pair<iterator,bool> insert(const nonconst_value_type& x)
-
In file included from include/boost/interprocess/containers/map.hpp:23:0,
from src/app/SharedOrderBook.h:7,
from src/app/futures_feed.cpp:20:
include/boost/container/map.hpp: In instantiation of ‘class boost::container::map<const long unsigned int, Order, std::less<const long unsigned int>, boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> > >’:
src/app/SharedOrderBook.h:120:19: required from here
include/boost/container/map.hpp:541:29: error: ‘std::pair<typename boost::container::container_detail::tree<Key, std::pair<const Key, T>, boost::container::container_detail::select1st<std::pair<const Key, T> >, Compare, Allocator, MapOptions>::iterator, bool> boost::container::map<Key, T, Compare, Allocator, Options>::insert(const nonconst_value_type&) [with Key = const long unsigned int; T = Order; Compare = std::less<const long unsigned int>; Allocator = boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> >; MapOptions = boost::container::tree_opt<(boost::container::tree_type_enum)0u, true>; typename boost::container::container_detail::tree<Key, std::pair<const Key, T>, boost::container::container_detail::select1st<std::pair<const Key, T> >, Compare, Allocator, MapOptions>::iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, false>; boost::container::map<Key, T, Compare, Allocator, Options>::nonconst_value_type = std::pair<const long unsigned int, Order>]’ cannot be overloaded
std::pair<iterator,bool> insert(const nonconst_value_type& x)
^~~~~~
include/boost/container/map.hpp:530:29: error: with ‘std::pair<typename boost::container::container_detail::tree<Key, std::pair<const Key, T>, boost::container::container_detail::select1st<std::pair<const Key, T> >, Compare, Allocator, MapOptions>::iterator, bool> boost::container::map<Key, T, Compare, Allocator, Options>::insert(const value_type&) [with Key = const long unsigned int; T = Order; Compare = std::less<const long unsigned int>; Allocator = boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> >; MapOptions = boost::container::tree_opt<(boost::container::tree_type_enum)0u, true>; typename boost::container::container_detail::tree<Key, std::pair<const Key, T>, boost::container::container_detail::select1st<std::pair<const Key, T> >, Compare, Allocator, MapOptions>::iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, false>; boost::container::map<Key, T, Compare, Allocator, Options>::value_type = std::pair<const long unsigned int, Order>]’
std::pair<iterator,bool> insert(const value_type& x)
^~~~~~
include/boost/container/map.hpp:574:29: error: ‘std::pair<typename boost::container::container_detail::tree<Key, std::pair<const Key, T>, boost::container::container_detail::select1st<std::pair<const Key, T> >, Compare, Allocator, MapOptions>::iterator, bool> boost::container::map<Key, T, Compare, Allocator, Options>::insert(boost::container::map<Key, T, Compare, Allocator, Options>::value_type&&) [with Key = const long unsigned int; T = Order; Compare = std::less<const long unsigned int>; Allocator = boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> >; MapOptions = boost::container::tree_opt<(boost::container::tree_type_enum)0u, true>; typename boost::container::container_detail::tree<Key, std::pair<const Key, T>, boost::container::container_detail::select1st<std::pair<const Key, T> >, Compare, Allocator, MapOptions>::iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, false>; boost::container::map<Key, T, Compare, Allocator, Options>::value_type = std::pair<const long unsigned int, Order>]’ cannot be overloaded
std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) x)
^~~~~~
include/boost/container/map.hpp:552:29: error: with ‘std::pair<typename boost::container::container_detail::tree<Key, std::pair<const Key, T>, boost::container::container_detail::select1st<std::pair<const Key, T> >, Compare, Allocator, MapOptions>::iterator, bool> boost::container::map<Key, T, Compare, Allocator, Options>::insert(boost::container::map<Key, T, Compare, Allocator, Options>::nonconst_value_type&&) [with Key = const long unsigned int; T = Order; Compare = std::less<const long unsigned int>; Allocator = boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> >; MapOptions = boost::container::tree_opt<(boost::container::tree_type_enum)0u, true>; typename boost::container::container_detail::tree<Key, std::pair<const Key, T>, boost::container::container_detail::select1st<std::pair<const Key, T> >, Compare, Allocator, MapOptions>::iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, false>; boost::container::map<Key, T, Compare, Allocator, Options>::nonconst_value_type = std::pair<const long unsigned int, Order>]’
std::pair<iterator,bool> insert(BOOST_RV_REF(nonconst_value_type) x)
^~~~~~
include/boost/container/map.hpp:619:13: error: ‘boost::container::map<Key, T, Compare, Allocator, Options>::iterator boost::container::map<Key, T, Compare, Allocator, Options>::insert(boost::container::map<Key, T, Compare, Allocator, Options>::const_iterator, const nonconst_value_type&) [with Key = const long unsigned int; T = Order; Compare = std::less<const long unsigned int>; Allocator = boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> >; MapOptions = boost::container::tree_opt<(boost::container::tree_type_enum)0u, true>; boost::container::map<Key, T, Compare, Allocator, Options>::iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, false>; boost::container::map<Key, T, Compare, Allocator, Options>::const_iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, true>; boost::container::map<Key, T, Compare, Allocator, Options>::nonconst_value_type = std::pair<const long unsigned int, Order>]’ cannot be overloaded
iterator insert(const_iterator p, const nonconst_value_type& x)
^~~~~~
include/boost/container/map.hpp:586:13: error: with ‘boost::container::map<Key, T, Compare, Allocator, Options>::iterator boost::container::map<Key, T, Compare, Allocator, Options>::insert(boost::container::map<Key, T, Compare, Allocator, Options>::const_iterator, const value_type&) [with Key = const long unsigned int; T = Order; Compare = std::less<const long unsigned int>; Allocator = boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> >; MapOptions = boost::container::tree_opt<(boost::container::tree_type_enum)0u, true>; boost::container::map<Key, T, Compare, Allocator, Options>::iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, false>; boost::container::map<Key, T, Compare, Allocator, Options>::const_iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, true>; boost::container::map<Key, T, Compare, Allocator, Options>::value_type = std::pair<const long unsigned int, Order>]’
iterator insert(const_iterator p, const value_type& x)
^~~~~~
include/boost/container/map.hpp:628:13: error: ‘boost::container::map<Key, T, Compare, Allocator, Options>::iterator boost::container::map<Key, T, Compare, Allocator, Options>::insert(boost::container::map<Key, T, Compare, Allocator, Options>::const_iterator, boost::container::map<Key, T, Compare, Allocator, Options>::value_type&&) [with Key = const long unsigned int; T = Order; Compare = std::less<const long unsigned int>; Allocator = boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> >; MapOptions = boost::container::tree_opt<(boost::container::tree_type_enum)0u, true>; boost::container::map<Key, T, Compare, Allocator, Options>::iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, false>; boost::container::map<Key, T, Compare, Allocator, Options>::const_iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, true>; boost::container::map<Key, T, Compare, Allocator, Options>::value_type = std::pair<const long unsigned int, Order>]’ cannot be overloaded
iterator insert(const_iterator p, BOOST_RV_REF(value_type) x)
^~~~~~
include/boost/container/map.hpp:598:13: error: with ‘boost::container::map<Key, T, Compare, Allocator, Options>::iterator boost::container::map<Key, T, Compare, Allocator, Options>::insert(boost::container::map<Key, T, Compare, Allocator, Options>::const_iterator, boost::container::map<Key, T, Compare, Allocator, Options>::nonconst_value_type&&) [with Key = const long unsigned int; T = Order; Compare = std::less<const long unsigned int>; Allocator = boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> >; MapOptions = boost::container::tree_opt<(boost::container::tree_type_enum)0u, true>; boost::container::map<Key, T, Compare, Allocator, Options>::iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, false>; boost::container::map<Key, T, Compare, Allocator, Options>::const_iterator = boost::container::container_detail::iterator_from_iiterator<boost::intrusive::tree_iterator<boost::intrusive::bhtraits<boost::container::container_detail::tree_node<std::pair<const long unsigned int, Order>, boost::interprocess::offset_ptr<void>, (boost::container::tree_type_enum)0u, true>, boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>, true>, (boost::intrusive::link_mode_type)0u, boost::intrusive::dft_tag, 3u>, false>, true>; boost::container::map<Key, T, Compare, Allocator, Options>::nonconst_value_type = std::pair<const long unsigned int, Order>]’
iterator insert(const_iterator p, BOOST_RV_REF(nonconst_value_type) x)
^~~~~~
In file included from include/boost/interprocess/segment_manager.hpp:33:0,
from include/boost/interprocess/detail/managed_memory_impl.hpp:30,
from include/boost/interprocess/managed_shared_memory.hpp:25,
from src/app/SharedOrderBook.h:6,
from src/app/futures_feed.cpp:20:
include/boost/interprocess/detail/named_proxy.hpp: In instantiation of ‘void boost::interprocess::ipcdetail::CtorArgN<T, is_iterator, Args>::construct(void*, boost::interprocess::ipcdetail::false_, const boost::container::container_detail::index_tuple<IdxPack ...>&) [with int ...IdxPack = {0, 1}; T = boost::container::map<const long unsigned int, Order, std::less<const long unsigned int>, boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> > >; bool is_iterator = false; Args = {std::less<long unsigned int>, boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0ul>, 0ul>, boost::interprocess::iset_index> >&}; boost::interprocess::ipcdetail::false_ = boost::interprocess::ipcdetail::bool_<false>]’:
include/boost/interprocess/detail/named_proxy.hpp:71:10: required from ‘void boost::interprocess::ipcdetail::CtorArgN<T, is_iterator, Args>::construct_n(void*, std::size_t, std::size_t&) [with T = boost::container::map<const long unsigned int, Order, std::less<const long unsigned int>, boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> > >; bool is_iterator = false; Args = {std::less<long unsigned int>, boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0ul>, 0ul>, boost::interprocess::iset_index> >&}; std::size_t = long unsigned int]’
src/app/futures_feed.cpp:170:1: required from here
include/boost/interprocess/detail/named_proxy.hpp:83:7: error: no matching function for call to ‘boost::container::map<const long unsigned int, Order, std::less<const long unsigned int>, boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> > >::map(std::less<long unsigned int>, boost::interprocess::allocator<std::pair<const long unsigned int, Order>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> >&)’
{ ::new((void*)mem, boost_container_new_t())T(boost::forward<Args>(get<IdxPack>(args_))...); }
If I get rid of the const uint64_t and use uint64_t for the key, I get the error below:
include/boost/container/map.hpp:150:7: error: static assertion failed: (container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value)
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
The question started here, but after all the updates it is already a different question with a different title.
My Graph type is defined as follows:
using Graph = boost::adjacency_list<vecS, setS, undirectedS, State, CostType>;
where CostType happens to be int.
I am trying to obtain the Kamada-Kawai spring layout as follows:
template <class PointMap>
PointMap layout() const {
PointMap res;
boost::associative_property_map<PointMap> temp(res);
circle_graph_layout(g_, temp, 10.0);
// https://stackoverflow.com/q/33903879/2725810
// https://stackoverflow.com/a/8555715/2725810
typedef std::map<VertexDescriptor, std::size_t> IndexMap;
IndexMap mapIndex;
associative_property_map<IndexMap> propmapIndex(mapIndex);
// http://www.boost.org/doc/libs/1_59_0/libs/graph/doc/bundles.html
kamada_kawai_spring_layout(g_, temp, get(edge_bundle, g_),
square_topology<>(50.0), side_length(50.0),
layout_tolerance<CostType>(),
CostType(1), propmapIndex);
return res;
}
gcc version 4.8.2 complains:
In file included from Graph.h:13:0,
from Astar.h:5,
from Test.cpp:4:
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp: In instantiation of ‘bool boost::detail::graph::kamada_kawai_spring_layout_impl<Topology, Graph, PositionMap, WeightMap, EdgeOrSideLength, Done, VertexIndexMap, DistanceMatrix, SpringStrengthMatrix, PartialDerivativeMap>::run() [with Topology = boost::square_topology<>; Graph = boost::adjacency_list<boost::vecS, boost::setS, boost::undirectedS, Pancake, int, boost::no_property, boost::listS>; PositionMap = boost::associative_property_map<std::map<void*, boost::convex_topology<2ul>::point, std::less<void*>, std::allocator<std::pair<void* const, boost::convex_topology<2ul>::point> > > >; WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, int, const int&, void*, const int, boost::edge_bundle_t>; EdgeOrSideLength = boost::detail::graph::edge_or_side<false, double>; Done = boost::layout_tolerance<int>; VertexIndexMap = boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >; DistanceMatrix = __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >; SpringStrengthMatrix = __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >; PartialDerivativeMap = boost::iterator_property_map<__gnu_cxx::__normal_iterator<boost::convex_topology<2ul>::point_difference*, std::vector<boost::convex_topology<2ul>::point_difference, std::allocator<boost::convex_topology<2ul>::point_difference> > >, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, boost::convex_topology<2ul>::point_difference, boost::convex_topology<2ul>::point_difference&>]’:
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp:524:20: required from ‘bool boost::kamada_kawai_spring_layout(const Graph&, PositionMap, WeightMap, const Topology&, boost::detail::graph::edge_or_side<EdgeOrSideLength, T>, Done, typename boost::property_traits<DistanceMap>::value_type, VertexIndexMap, DistanceMatrix, SpringStrengthMatrix, PartialDerivativeMap) [with Topology = boost::square_topology<>; Graph = boost::adjacency_list<boost::vecS, boost::setS, boost::undirectedS, Pancake, int, boost::no_property, boost::listS>; PositionMap = boost::associative_property_map<std::map<void*, boost::convex_topology<2ul>::point, std::less<void*>, std::allocator<std::pair<void* const, boost::convex_topology<2ul>::point> > > >; WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, int, const int&, void*, const int, boost::edge_bundle_t>; T = double; bool EdgeOrSideLength = false; Done = boost::layout_tolerance<int>; VertexIndexMap = boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >; DistanceMatrix = __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >; SpringStrengthMatrix = __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >; PartialDerivativeMap = boost::iterator_property_map<__gnu_cxx::__normal_iterator<boost::convex_topology<2ul>::point_difference*, std::vector<boost::convex_topology<2ul>::point_difference, std::allocator<boost::convex_topology<2ul>::point_difference> > >, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, boost::convex_topology<2ul>::point_difference, boost::convex_topology<2ul>::point_difference&>; typename boost::property_traits<DistanceMap>::value_type = int]’
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp:559:79: required from ‘bool boost::kamada_kawai_spring_layout(const Graph&, PositionMap, WeightMap, const Topology&, boost::detail::graph::edge_or_side<EdgeOrSideLength, T>, Done, typename boost::property_traits<DistanceMap>::value_type, VertexIndexMap) [with Topology = boost::square_topology<>; Graph = boost::adjacency_list<boost::vecS, boost::setS, boost::undirectedS, Pancake, int, boost::no_property, boost::listS>; PositionMap = boost::associative_property_map<std::map<void*, boost::convex_topology<2ul>::point, std::less<void*>, std::allocator<std::pair<void* const, boost::convex_topology<2ul>::point> > > >; WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, int, const int&, void*, const int, boost::edge_bundle_t>; T = double; bool EdgeOrSideLength = false; Done = boost::layout_tolerance<int>; VertexIndexMap = boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >; typename boost::property_traits<DistanceMap>::value_type = int]’
Graph.h:112:61: required from ‘PointMap StateGraph<StateNeighbor>::layout() const [with PointMap = std::map<void*, boost::convex_topology<2ul>::point, std::less<void*>, std::allocator<std::pair<void* const, boost::convex_topology<2ul>::point> > >; StateNeighbor = StateNeighbor<Pancake>]’
Drawer.h:60:75: required from ‘Drawer<Graph>::Drawer(const Graph&) [with Graph = StateGraph<StateNeighbor<Pancake> >]’
Test.cpp:34:22: required from here
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp:313:96: error: no matching function for call to ‘boost::detail::graph::linear_solver<2ul>::solve(boost::detail::graph::kamada_kawai_spring_layout_impl<boost::square_topology<>, boost::adjacency_list<boost::vecS, boost::setS, boost::undirectedS, Pancake, int, boost::no_property, boost::listS>, boost::associative_property_map<std::map<void*, boost::convex_topology<2ul>::point, std::less<void*>, std::allocator<std::pair<void* const, boost::convex_topology<2ul>::point> > > >, boost::adj_list_edge_property_map<boost::undirected_tag, int, const int&, void*, const int, boost::edge_bundle_t>, boost::detail::graph::edge_or_side<false, double>, boost::layout_tolerance<int>, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >, __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >, boost::iterator_property_map<__gnu_cxx::__normal_iterator<boost::convex_topology<2ul>::point_difference*, std::vector<boost::convex_topology<2ul>::point_difference, std::allocator<boost::convex_topology<2ul>::point_difference> > >, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, boost::convex_topology<2ul>::point_difference, boost::convex_topology<2ul>::point_difference&> >::weight_type [2][2], boost::detail::graph::kamada_kawai_spring_layout_impl<boost::square_topology<>, boost::adjacency_list<boost::vecS, boost::setS, boost::undirectedS, Pancake, int, boost::no_property, boost::listS>, boost::associative_property_map<std::map<void*, boost::convex_topology<2ul>::point, std::less<void*>, std::allocator<std::pair<void* const, boost::convex_topology<2ul>::point> > > >, boost::adj_list_edge_property_map<boost::undirected_tag, int, const int&, void*, const int, boost::edge_bundle_t>, boost::detail::graph::edge_or_side<false, double>, boost::layout_tolerance<int>, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >, __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >, boost::iterator_property_map<__gnu_cxx::__normal_iterator<boost::convex_topology<2ul>::point_difference*, std::vector<boost::convex_topology<2ul>::point_difference, std::allocator<boost::convex_topology<2ul>::point_difference> > >, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, boost::convex_topology<2ul>::point_difference, boost::convex_topology<2ul>::point_difference&> >::deriv_type&)’
_difference_type delta = -linear_solver<Point::dimensions>::solve(dE_d_d, dE_d);
^
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp:313:96: note: candidate is:
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp:95:18: note: template<class Vec> static Vec boost::detail::graph::linear_solver<2ul>::solve(double (*)[2], Vec)
static Vec solve(double mat[2][2], Vec rhs) {
^
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp:95:18: note: template argument deduction/substitution failed:
/home/meir/boost_1_59_0/boost/graph/kamada_kawai_spring_layout.hpp:313:96: note: cannot convert ‘dE_d_d’ (type ‘boost::detail::graph::kamada_kawai_spring_layout_impl<boost::square_topology<>, boost::adjacency_list<boost::vecS, boost::setS, boost::undirectedS, Pancake, int, boost::no_property, boost::listS>, boost::associative_property_map<std::map<void*, boost::convex_topology<2ul>::point, std::less<void*>, std::allocator<std::pair<void* const, boost::convex_topology<2ul>::point> > > >, boost::adj_list_edge_property_map<boost::undirected_tag, int, const int&, void*, const int, boost::edge_bundle_t>, boost::detail::graph::edge_or_side<false, double>, boost::layout_tolerance<int>, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >, __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int>, std::allocator<std::vector<int> > > >, boost::iterator_property_map<__gnu_cxx::__normal_iterator<boost::convex_topology<2ul>::point_difference*, std::vector<boost::convex_topology<2ul>::point_difference, std::allocator<boost::convex_topology<2ul>::point_difference> > >, boost::associative_property_map<std::map<void*, long unsigned int, std::less<void*>, std::allocator<std::pair<void* const, long unsigned int> > > >, boost::convex_topology<2ul>::point_difference, boost::convex_topology<2ul>::point_difference&> >::weight_type [2][2] {aka int [2][2]}’) to type ‘double (*)[2]’
_difference_type delta = -linear_solver<Point::dimensions>::solve(dE_d_d, dE_d);
This message is too cryptic for me to understand. It has something to do with not being able to convert int [2][2] to double (*)[2]. Is this related to the fact that CostType is int? But why can't it be? I will very much appreciate help in understanding what I am doing wrong.
Indeed, the error indicates the weights must be doubles.
That's because the algorithm invokes a linear solver with the raw points, and that's failing because the weight type is not a real number type.
If you change
using CostType = double;
everything compiles fine. Live On Coliru
If you insist, you can use a transformation:
#include <boost/property_map/transform_value_property_map.hpp>
kamada_kawai_spring_layout(g_, temp,
boost::make_transform_value_property_map([](int i) -> double { return i; }, get(edge_bundle, g_)),
square_topology<>(50.0),
side_length(50.0),
layout_tolerance<double>(),
double(1),
propmapIndex);
If you don't want to use the lambda, use a functor:
struct to_double { double operator()(int i) const { return i; } };
kamada_kawai_spring_layout(g_, temp,
boost::make_transform_value_property_map(to_double(), get(edge_bundle, g_)),
square_topology<>(50.0),
side_length(50.0),
layout_tolerance<double>(),
double(1),
propmapIndex);
I'm using boost 1.53 and GCC 4.1.2. I've tried to use boost unordered_map in some tests (documentation says, that it should work with shared memory), but i'm unable to compile my code. With interprocess::map instead of unordered everything is ok.
Typedefs:
typedef boost::interprocess::allocator<char, SegmentManager> CharAllocator;
typedef boost::interprocess::basic_string<char, std::char_traits<char>, CharAllocator> ShmString;
typedef ShmString HashKeyType;
//ComplexType is a wrapper for internal interprocess::map
typedef ComplexType HashMappedType;
typedef std::pair<const ShmString, ComplexType> HashValueType;
typedef boost::interprocess::allocator<HashValueType,
boost::interprocess::managed_shared_memory::segment_manager> HashMemAllocator;
typedef boost::unordered_map
< HashKeyType , HashMappedType
, boost::hash<HashKeyType> ,std::equal_to<HashKeyType>
, HashMemAllocator>
TestHashMap;
Allocation:
boost::interprocess::managed_shared_memory segment( boost::interprocess::open_or_create, "MySharedMemory", 65536);
thm_ = segment.construct<TestHashMap>("TestHashMap")
(3, boost::hash<ShmString>(), std::equal_to<ShmString>()
, segment.get_allocator<HashValueType>());
Usage:
boost::interprocess::managed_shared_memory segment( boost::interprocess::open_only, "MySharedMemory");
ShmString str("123.345", segment.get_allocator<ShmString>());
ComplexType th("MySharedMemory");
HashValueType value(str, th);
thm_->insert(value);
And here is some error output:
../boost/include/boost/unordered/detail/allocate.hpp: In instantiation of 'boost::unordered::detail::allocator_traits<boost::interprocess::allocator<boost::unordered::detail::ptr_node<std::pair<const boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >, TINHolderShared> >, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >::pointer_to_other<const boost::unordered::detail::ptr_node<std::pair<const boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >, TINHolderShared> > >':
../boost/include/boost/unordered/detail/allocate.hpp:527: instantiated from 'boost::unordered::detail::allocator_traits<boost::interprocess::allocator<boost::unordered::detail::ptr_node<std::pair<const boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >, TINHolderShared> >, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >'
../boost/include/boost/unordered/detail/unique.hpp:114: instantiated from 'boost::unordered::detail::pick_node<boost::interprocess::allocator<std::pair<const boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >, TINHolderShared>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> >, std::pair<const boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >, TINHolderShared> >'
../boost/include/boost/unordered/detail/unique.hpp:158: instantiated from 'boost::unordered::detail::map<boost::interprocess::allocator<std::pair<const boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >, TINHolderShared>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> >, boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >, TINHolderShared, boost::hash<boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > > >, std::equal_to<boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > > > >'
../boost/include/boost/unordered/unordered_map.hpp:59: instantiated from 'boost::unordered::unordered_map<boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >, TINHolderShared, boost::hash<boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > > >, std::equal_to<boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > > >, boost::interprocess::allocator<std::pair<const boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >, TINHolderShared>, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >'
utest/THUnitTests.cc:96: instantiated from here
../boost/include/boost/unordered/detail/allocate.hpp:523: error: ambiguous class template instantiation for 'struct boost::pointer_to_other<boost::interprocess::offset_ptr<boost::unordered::detail::ptr_node<std::pair<const boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >, TINHolderShared> >, long int, long unsigned int, 0u>, const boost::unordered::detail::ptr_node<std::pair<const boost::container::basic_string<char, std::char_traits<char>, boost::interprocess::allocator<char, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long int, long unsigned int, 0u>, 0ul>, boost::interprocess::iset_index> > >, TINHolderShared> > >'
../boost/include/boost/interprocess/offset_ptr.hpp:721: error: candidates are: struct boost::pointer_to_other<boost::interprocess::offset_ptr<T1, P1, O1, A1>, U>
../boost/include/boost/pointer_to_other.hpp:29: error: struct boost::pointer_to_other<Sp<T>, U>
../boost/include/boost/pointer_to_other.hpp:36: error: struct boost::pointer_to_other<Sp<T, T2>, U>
../boost/include/boost/pointer_to_other.hpp:43: error: struct boost::pointer_to_other<Sp<T, T2, T3>, U>
I'm not sure if the problem is in my code, or because of old compiler version.
If the problem is with compiler, then could it be fixed with newer version of boost? (i can't update my GCC). Or maybe there are some implementations of hash table, that are compatible with shared memory and with my compiler?
Here's a fixed up version.
I just tried to make it self contained according to the suggestive comments. And it works.
Hope it helps anyways:
Live On Coliru
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/containers/string.hpp>
#include <boost/interprocess/containers/map.hpp>
#include <boost/unordered_map.hpp>
namespace bip = boost::interprocess;
// ShmString is boost::interprocess::basic_string
typedef bip::allocator<char, bip::managed_shared_memory::segment_manager> CharAllocator;
typedef bip::basic_string<char, std::char_traits<char>, CharAllocator> ShmString;
typedef ShmString HashKeyType;
// ComplexType is a wrapper for internal interprocess::map
struct ComplexType {
typedef bip::allocator<std::pair<int const, int>, bip::managed_shared_memory::segment_manager> Alloc;
typedef bip::map<int, int, std::less<int>, Alloc> Map;
template <typename Alloc2>
ComplexType(std::string, Alloc2 const& alloc = {}) : map(alloc) {}
Map map;
};
typedef ComplexType HashMappedType;
typedef std::pair<const ShmString, ComplexType> HashValueType;
typedef bip::allocator<HashValueType, bip::managed_shared_memory::segment_manager> HashMemAllocator;
typedef boost::unordered_map<HashKeyType, HashMappedType, boost::hash<HashKeyType>, std::equal_to<HashKeyType>, HashMemAllocator>
TestHashMap;
int main()
{
// Allocation:
{
bip::managed_shared_memory segment(bip::open_or_create, "MySharedMemory", 65536);
auto thm_ = segment.construct<TestHashMap>("TestHashMap")(3, boost::hash<ShmString>(), std::equal_to<ShmString>(),
segment.get_allocator<HashValueType>());
}
// Usage:
bip::managed_shared_memory segment(bip::open_only, "MySharedMemory");
auto thm_ = segment.construct<TestHashMap>("TestHashMap")(3, boost::hash<ShmString>(), std::equal_to<ShmString>(), segment.get_allocator<HashValueType>());
ShmString str("123.345", segment.get_allocator<ShmString>());
ComplexType th("MySharedMemory", segment.get_segment_manager());
HashValueType value(str, th);
thm_->insert(value);
}
I am using BGL and have recently migrated to 1.57.0 from 1.46.1. I also switched from using Xcode on a mac to gcc 4.9.2.
I am getting a no matching function call to get and have created this small snipet of code to illustrate the problem. If I change the INCLUDE path to be 1.46.1, this code works great, its on 1.55.0 and 1.57.0 that it fails.
Any advice appreciated.
Thanks.
#include <boost/config.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/connected_components.hpp>
#include <boost/graph/strong_components.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
struct EdgeDef
{
double dist;
double prop1;
};
typedef boost::adjacency_list < boost::listS, boost::vecS, boost::directedS,boost::no_property,EdgeDef > Graph;
int main() {
Graph g;
std::vector<double> d(num_vertices(g));
std::vector<Graph::vertex_descriptor> p(num_vertices(g));
Graph::vertex_descriptor s = 0;
dijkstra_shortest_paths(g,s,
boost::predecessor_map(&p[0]).distance_map(&d[0]).
weight_map(get(&EdgeDef::dist,g)));
}
Error log from building with gcc
2:37:37 **** Incremental Build of configuration Debug for project TestBGL ****
make all
Building file: ../src/TestBGL.cpp
Invoking: GCC C++ Compiler
/usr/local/bin/g++-4.9 -I/Users/flyboy777/Downloads/boost_1_57_0 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/TestBGL.d" -MT"src/TestBGL.d" -o "src/TestBGL.o" "../src/TestBGL.cpp"
In file included from ../src/TestBGL.cpp:6:0:
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp: In instantiation of 'void boost::detail::dijkstra_bfs_visitor<UniformCostVisitor, UpdatableQueue, WeightMap, PredecessorMap, DistanceMap, BinaryFunction, BinaryPredicate>::gray_target(Edge, Graph&) [with Edge = boost::detail::edge_desc_impl<boost::directed_tag, long unsigned int>; Graph = const boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; UniformCostVisitor = boost::dijkstra_visitor<>; UpdatableQueue = boost::d_ary_heap_indirect<long unsigned int, 4ul, boost::iterator_property_map<long unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>, long unsigned int, long unsigned int&>, double*, std::less<double>, std::vector<long unsigned int> >; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; PredecessorMap = long unsigned int*; DistanceMap = double*; BinaryFunction = boost::closed_plus<double>; BinaryPredicate = std::less<double>]':
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/breadth_first_search.hpp:87:47: required from 'void boost::breadth_first_visit(const IncidenceGraph&, SourceIterator, SourceIterator, Buffer&, BFSVisitor, ColorMap) [with IncidenceGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; Buffer = boost::d_ary_heap_indirect<long unsigned int, 4ul, boost::iterator_property_map<long unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>, long unsigned int, long unsigned int&>, double*, std::less<double>, std::vector<long unsigned int> >; BFSVisitor = boost::detail::dijkstra_bfs_visitor<boost::dijkstra_visitor<>, boost::d_ary_heap_indirect<long unsigned int, 4ul, boost::iterator_property_map<long unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>, long unsigned int, long unsigned int&>, double*, std::less<double>, std::vector<long unsigned int> >, boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, long unsigned int*, double*, boost::closed_plus<double>, std::less<double> >; ColorMap = boost::two_bit_color_map<boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int> >; SourceIterator = long unsigned int*]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:383:61: required from 'void boost::dijkstra_shortest_paths_no_init(const Graph&, SourceInputIter, SourceInputIter, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistZero, DijkstraVisitor, ColorMap) [with Graph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; SourceInputIter = long unsigned int*; DijkstraVisitor = boost::dijkstra_visitor<>; PredecessorMap = long unsigned int*; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>; Compare = std::less<double>; Combine = boost::closed_plus<double>; DistZero = double; ColorMap = boost::two_bit_color_map<boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int> >]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:478:34: required from 'void boost::dijkstra_shortest_paths(const VertexListGraph&, SourceInputIter, SourceInputIter, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistInf, DistZero, DijkstraVisitor, ColorMap) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; SourceInputIter = long unsigned int*; DijkstraVisitor = boost::dijkstra_visitor<>; PredecessorMap = long unsigned int*; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>; Compare = std::less<double>; Combine = boost::closed_plus<double>; DistInf = double; DistZero = double; ColorMap = boost::two_bit_color_map<boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int> >]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:425:34: required from 'void boost::dijkstra_shortest_paths(const VertexListGraph&, SourceInputIter, SourceInputIter, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistInf, DistZero, DijkstraVisitor, const boost::bgl_named_params<T, Tag, Base>&, typename boost::enable_if_c<boost::is_base_and_derived<boost::vertex_list_graph_tag, typename boost::graph_traits<Graph>::traversal_category>::value, boost::graph::detail::no_parameter>::type) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; SourceInputIter = long unsigned int*; DijkstraVisitor = boost::dijkstra_visitor<>; PredecessorMap = long unsigned int*; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>; Compare = std::less<double>; Combine = boost::closed_plus<double>; DistInf = double; DistZero = double; T = char; Tag = boost::detail::unused_tag_type; Base = boost::no_property; typename boost::enable_if_c<boost::is_base_and_derived<boost::vertex_list_graph_tag, typename boost::graph_traits<Graph>::traversal_category>::value, boost::graph::detail::no_parameter>::type = boost::graph::detail::no_parameter]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:518:50: required from 'void boost::dijkstra_shortest_paths(const VertexListGraph&, SourceInputIter, SourceInputIter, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistInf, DistZero, DijkstraVisitor) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; SourceInputIter = long unsigned int*; DijkstraVisitor = boost::dijkstra_visitor<>; PredecessorMap = long unsigned int*; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>; Compare = std::less<double>; Combine = boost::closed_plus<double>; DistInf = double; DistZero = double]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:446:72: required from 'void boost::dijkstra_shortest_paths(const VertexListGraph&, typename boost::graph_traits<Graph>::vertex_descriptor, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistInf, DistZero, DijkstraVisitor, const boost::bgl_named_params<T, Tag, Base>&, typename boost::enable_if_c<boost::is_base_and_derived<boost::vertex_list_graph_tag, typename boost::graph_traits<Graph>::traversal_category>::value, boost::graph::detail::no_parameter>::type) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; DijkstraVisitor = boost::dijkstra_visitor<>; PredecessorMap = long unsigned int*; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>; Compare = std::less<double>; Combine = boost::closed_plus<double>; DistInf = double; DistZero = double; T = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; Tag = boost::edge_weight_t; Base = boost::bgl_named_params<double*, boost::vertex_distance_t, boost::bgl_named_params<long unsigned int*, boost::vertex_predecessor_t, boost::no_property> >; typename boost::graph_traits<Graph>::vertex_descriptor = long unsigned int; typename boost::enable_if_c<boost::is_base_and_derived<boost::vertex_list_graph_tag, typename boost::graph_traits<Graph>::traversal_category>::value, boost::graph::detail::no_parameter>::type = boost::graph::detail::no_parameter]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:573:16: required from 'void boost::detail::dijkstra_dispatch2(const VertexListGraph&, typename boost::graph_traits<Graph>::vertex_descriptor, DistanceMap, WeightMap, IndexMap, const Params&) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>; Params = boost::bgl_named_params<boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, boost::edge_weight_t, boost::bgl_named_params<double*, boost::vertex_distance_t, boost::bgl_named_params<long unsigned int*, boost::vertex_predecessor_t, boost::no_property> > >; typename boost::graph_traits<Graph>::vertex_descriptor = long unsigned int]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:595:35: required from 'void boost::detail::dijkstra_dispatch1(const VertexListGraph&, typename boost::graph_traits<Graph>::vertex_descriptor, DistanceMap, WeightMap, IndexMap, const Params&) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>; Params = boost::bgl_named_params<boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, boost::edge_weight_t, boost::bgl_named_params<double*, boost::vertex_distance_t, boost::bgl_named_params<long unsigned int*, boost::vertex_predecessor_t, boost::no_property> > >; typename boost::graph_traits<Graph>::vertex_descriptor = long unsigned int]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:614:14: required from 'void boost::dijkstra_shortest_paths(const VertexListGraph&, typename boost::graph_traits<Graph>::vertex_descriptor, const boost::bgl_named_params<T, Tag, Base>&) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; Param = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; Tag = boost::edge_weight_t; Rest = boost::bgl_named_params<double*, boost::vertex_distance_t, boost::bgl_named_params<long unsigned int*, boost::vertex_predecessor_t, boost::no_property> >; typename boost::graph_traits<Graph>::vertex_descriptor = long unsigned int]'
../src/TestBGL.cpp:26:62: required from here
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:141:54: error: no matching function for call to 'get(double*&, long unsigned int)'
D old_distance = get(m_distance, target(e, g));
^
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:141:54: note: candidate is:
In file included from /Users/flyboy777/Downloads/boost_1_57_0/boost/graph/transpose_graph.hpp:16:0,
from /Users/flyboy777/Downloads/boost_1_57_0/boost/graph/strong_components.hpp:262,
from ../src/TestBGL.cpp:5:
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/reverse_graph.hpp:433:3: note: template<class E> E boost::detail::get(boost::detail::underlying_edge_desc_map_type<E>, const boost::detail::reverse_graph_edge_descriptor<EdgeDesc>&)
get(underlying_edge_desc_map_type<E> m,
^
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/reverse_graph.hpp:433:3: note: template argument deduction/substitution failed:
In file included from ../src/TestBGL.cpp:6:0:
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:141:54: note: mismatched types 'boost::detail::underlying_edge_desc_map_type<E>' and 'double*'
D old_distance = get(m_distance, target(e, g));
^
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp: In instantiation of 'void boost::detail::dijkstra_bfs_visitor<UniformCostVisitor, UpdatableQueue, WeightMap, PredecessorMap, DistanceMap, BinaryFunction, BinaryPredicate>::gray_target(Edge, Graph&) [with Edge = boost::detail::edge_desc_impl<boost::directed_tag, long unsigned int>; Graph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; UniformCostVisitor = boost::dijkstra_visitor<>; UpdatableQueue = boost::d_ary_heap_indirect<long unsigned int, 4ul, boost::iterator_property_map<long unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>, long unsigned int, long unsigned int&>, double*, std::less<double>, std::vector<long unsigned int> >; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; PredecessorMap = long unsigned int*; DistanceMap = double*; BinaryFunction = boost::closed_plus<double>; BinaryPredicate = std::less<double>]':
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/breadth_first_search.hpp:45:7: required from 'void boost::BFSVisitorConcept<Visitor, Graph>::constraints() [with Visitor = boost::detail::dijkstra_bfs_visitor<boost::dijkstra_visitor<>, boost::d_ary_heap_indirect<long unsigned int, 4ul, boost::iterator_property_map<long unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>, long unsigned int, long unsigned int&>, double*, std::less<double>, std::vector<long unsigned int> >, boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, long unsigned int*, double*, boost::closed_plus<double>, std::less<double> >; Graph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/concept/detail/has_constraints.hpp:32:62: required by substitution of 'template<class Model> boost::concepts::detail::yes boost::concepts::detail::has_constraints_(Model*, boost::concepts::detail::wrap_constraints<Model, (& Model:: constraints)>*) [with Model = boost::BFSVisitorConcept<boost::detail::dijkstra_bfs_visitor<boost::dijkstra_visitor<>, boost::d_ary_heap_indirect<long unsigned int, 4ul, boost::iterator_property_map<long unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>, long unsigned int, long unsigned int&>, double*, std::less<double>, std::vector<long unsigned int> >, boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, long unsigned int*, double*, boost::closed_plus<double>, std::less<double> >, boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef> >]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/concept/detail/has_constraints.hpp:42:5: required from 'const bool boost::concepts::not_satisfied<boost::BFSVisitorConcept<boost::detail::dijkstra_bfs_visitor<boost::dijkstra_visitor<>, boost::d_ary_heap_indirect<long unsigned int, 4ul, boost::iterator_property_map<long unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>, long unsigned int, long unsigned int&>, double*, std::less<double>, std::vector<long unsigned int> >, boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, long unsigned int*, double*, boost::closed_plus<double>, std::less<double> >, boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef> > >::value'
/Users/flyboy777/Downloads/boost_1_57_0/boost/concept/detail/has_constraints.hpp:45:31: required from 'struct boost::concepts::not_satisfied<boost::BFSVisitorConcept<boost::detail::dijkstra_bfs_visitor<boost::dijkstra_visitor<>, boost::d_ary_heap_indirect<long unsigned int, 4ul, boost::iterator_property_map<long unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>, long unsigned int, long unsigned int&>, double*, std::less<double>, std::vector<long unsigned int> >, boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, long unsigned int*, double*, boost::closed_plus<double>, std::less<double> >, boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef> > >'
/Users/flyboy777/Downloads/boost_1_57_0/boost/mpl/if.hpp:67:11: required from 'struct boost::mpl::if_<boost::concepts::not_satisfied<boost::BFSVisitorConcept<boost::detail::dijkstra_bfs_visitor<boost::dijkstra_visitor<>, boost::d_ary_heap_indirect<long unsigned int, 4ul, boost::iterator_property_map<long unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>, long unsigned int, long unsigned int&>, double*, std::less<double>, std::vector<long unsigned int> >, boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, long unsigned int*, double*, boost::closed_plus<double>, std::less<double> >, boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef> > >, boost::concepts::constraint<boost::BFSVisitorConcept<boost::detail::dijkstra_bfs_visitor<boost::dijkstra_visitor<>, boost::d_ary_heap_indirect<long unsigned int, 4ul, boost::iterator_property_map<long unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>, long unsigned int, long unsigned int&>, double*, std::less<double>, std::vector<long unsigned int> >, boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, long unsigned int*, double*, boost::closed_plus<double>, std::less<double> >, boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef> > >, boost::concepts::requirement<boost::concepts::failed************ boost::BFSVisitorConcept<boost::detail::dijkstra_bfs_visitor<boost::dijkstra_visitor<>, boost::d_ary_heap_indirect<long unsigned int, 4ul, boost::iterator_property_map<long unsigned int*, boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>, long unsigned int, long unsigned int&>, double*, std::less<double>, std::vector<long unsigned int> >, boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, long unsigned int*, double*, boost::closed_plus<double>, std::less<double> >, boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef> >::************> >'
/Users/flyboy777/Downloads/boost_1_57_0/boost/concept/detail/general.hpp:50:8: [ skipping 5 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:518:50: required from 'void boost::dijkstra_shortest_paths(const VertexListGraph&, SourceInputIter, SourceInputIter, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistInf, DistZero, DijkstraVisitor) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; SourceInputIter = long unsigned int*; DijkstraVisitor = boost::dijkstra_visitor<>; PredecessorMap = long unsigned int*; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>; Compare = std::less<double>; Combine = boost::closed_plus<double>; DistInf = double; DistZero = double]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:446:72: required from 'void boost::dijkstra_shortest_paths(const VertexListGraph&, typename boost::graph_traits<Graph>::vertex_descriptor, PredecessorMap, DistanceMap, WeightMap, IndexMap, Compare, Combine, DistInf, DistZero, DijkstraVisitor, const boost::bgl_named_params<T, Tag, Base>&, typename boost::enable_if_c<boost::is_base_and_derived<boost::vertex_list_graph_tag, typename boost::graph_traits<Graph>::traversal_category>::value, boost::graph::detail::no_parameter>::type) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; DijkstraVisitor = boost::dijkstra_visitor<>; PredecessorMap = long unsigned int*; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>; Compare = std::less<double>; Combine = boost::closed_plus<double>; DistInf = double; DistZero = double; T = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; Tag = boost::edge_weight_t; Base = boost::bgl_named_params<double*, boost::vertex_distance_t, boost::bgl_named_params<long unsigned int*, boost::vertex_predecessor_t, boost::no_property> >; typename boost::graph_traits<Graph>::vertex_descriptor = long unsigned int; typename boost::enable_if_c<boost::is_base_and_derived<boost::vertex_list_graph_tag, typename boost::graph_traits<Graph>::traversal_category>::value, boost::graph::detail::no_parameter>::type = boost::graph::detail::no_parameter]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:573:16: required from 'void boost::detail::dijkstra_dispatch2(const VertexListGraph&, typename boost::graph_traits<Graph>::vertex_descriptor, DistanceMap, WeightMap, IndexMap, const Params&) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>; Params = boost::bgl_named_params<boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, boost::edge_weight_t, boost::bgl_named_params<double*, boost::vertex_distance_t, boost::bgl_named_params<long unsigned int*, boost::vertex_predecessor_t, boost::no_property> > >; typename boost::graph_traits<Graph>::vertex_descriptor = long unsigned int]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:595:35: required from 'void boost::detail::dijkstra_dispatch1(const VertexListGraph&, typename boost::graph_traits<Graph>::vertex_descriptor, DistanceMap, WeightMap, IndexMap, const Params&) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; DistanceMap = double*; WeightMap = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; IndexMap = boost::vec_adj_list_vertex_id_map<boost::no_property, long unsigned int>; Params = boost::bgl_named_params<boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>, boost::edge_weight_t, boost::bgl_named_params<double*, boost::vertex_distance_t, boost::bgl_named_params<long unsigned int*, boost::vertex_predecessor_t, boost::no_property> > >; typename boost::graph_traits<Graph>::vertex_descriptor = long unsigned int]'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:614:14: required from 'void boost::dijkstra_shortest_paths(const VertexListGraph&, typename boost::graph_traits<Graph>::vertex_descriptor, const boost::bgl_named_params<T, Tag, Base>&) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::vecS, boost::directedS, boost::no_property, EdgeDef>; Param = boost::adj_list_edge_property_map<boost::directed_tag, double, double&, long unsigned int, EdgeDef, double EdgeDef::*>; Tag = boost::edge_weight_t; Rest = boost::bgl_named_params<double*, boost::vertex_distance_t, boost::bgl_named_params<long unsigned int*, boost::vertex_predecessor_t, boost::no_property> >; typename boost::graph_traits<Graph>::vertex_descriptor = long unsigned int]'
../src/TestBGL.cpp:26:62: required from here
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:141:54: error: no matching function for call to 'get(double*&, long unsigned int)'
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:141:54: note: candidate is:
In file included from /Users/flyboy777/Downloads/boost_1_57_0/boost/graph/transpose_graph.hpp:16:0,
from /Users/flyboy777/Downloads/boost_1_57_0/boost/graph/strong_components.hpp:262,
from ../src/TestBGL.cpp:5:
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/reverse_graph.hpp:433:3: note: template<class E> E boost::detail::get(boost::detail::underlying_edge_desc_map_type<E>, const boost::detail::reverse_graph_edge_descriptor<EdgeDesc>&)
get(underlying_edge_desc_map_type<E> m,
^
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/reverse_graph.hpp:433:3: note: template argument deduction/substitution failed:
In file included from ../src/TestBGL.cpp:6:0:
/Users/flyboy777/Downloads/boost_1_57_0/boost/graph/dijkstra_shortest_paths.hpp:141:54: note: mismatched types 'boost::detail::underlying_edge_desc_map_type<E>' and 'double*'
D old_distance = get(m_distance, target(e, g));
^
make: *** [src/TestBGL.o] Error 1
22:37:39 Build Finished (took 2s.330ms)
You should update your code according to changes in property maps in 1.55.
Use make_iterator_property_map instead of raw pointers:
dijkstra_shortest_paths(g,s,
boost::predecessor_map(boost::make_iterator_property_map(p.begin(), get(boost::vertex_index, g))).
distance_map(boost::make_iterator_property_map(d.begin(), get(boost::vertex_index, g))).
weight_map(get(&EdgeDef::dist,g)));
See changes in 1.55 and this bug https://svn.boost.org/trac/boost/ticket/7877
I'm trying to create a std::unordered_map, using a user-defined hash function and equality predicate, for matrix rows of integral built-in types. I use std::bind, since I need the hashing and equality functors to work for variable ranges. How would I get the following code to compile and work as intended? I'm guessing that my mistake is towards the bottom of the listing, where I use std::bind and instantiate the std::unordered_map.
Some clarifications:
I can't use boost::hash_combine because I care about individual bits in the integers stored in the matrix row, so unless I create my own iterator, boost::hash_combine would combine whole integers, leading to erroneous results. Also, I need the hash and equality functors to work on ranges from 1 to ~200,000, so specifying the range in template parameters would not be a reasonable option.
template <class T,class F,class A>
struct row_hash_right : std::function<size_t(
ublas::matrix_row<ublas::matrix<T,F,A>>,
unsigned, unsigned)>
{
typedef ublas::matrix_row<ublas::matrix<T,F,A>> row_type;
// I want to use std::bind to bind the last two arguments.
size_t operator()(row_type& a, unsigned s, unsigned e)
{
// Implementation of hash function.
}
};
template <class T,class F,class A>
struct row_equal_right : std::function<bool(
ublas::matrix_row<ublas::matrix<T,F,A>>,
ublas::matrix_row<ublas::matrix<T,F,A>>,
unsigned, unsigned)>
{
typedef ublas::matrix_row<ublas::matrix<T,F,A>> row_type;
bool operator()(row_type& a, row_type& b, unsigned s, unsigned e)
{
// Implementation of equality predicate.
}
};
// Inside a function.
for (unsigned i = 0; i < len; ++i) {
for (unsigned j = i + 1; j < len; ++j) {
auto x = std::bind(r_hash, _1, i, j);
auto y = std::bind(r_equal, _1, _2, i, j);
// ERROR:
std::unordered_map<row_type, unsigned,
decltype(x), decltype(y)> m(256, x, y);
}
}
The error:
Here is (what I think) the most important part of the error produced upon attempted compilation:
/usr/include/c++/4.6/bits/stl_pair.h:92:11: error: ‘std::pair<_T1,
_T2>::first’ has incomplete type
/usr/include/boost/numeric/ublas/fwd.hpp:73:11: error: declaration of ‘const struct
boost::numeric::ublas::matrix_row,
boost::numeric::ublas::unbounded_array > > >’
If you want the see the whole thing, I've dumped it all here:
In file included from /usr/include/c++/4.6/bits/stl_algobase.h:65:0,
from /usr/include/c++/4.6/bits/char_traits.h:41,
from /usr/include/c++/4.6/ios:41,
from /usr/include/c++/4.6/ostream:40,
from /usr/include/c++/4.6/iostream:40,
from src/test/read_test.cpp:1:
/usr/include/c++/4.6/bits/stl_pair.h: In instantiation of ‘std::pair, boost::numeric::ublas::unbounded_array > > >, unsigned int>’:
/usr/include/c++/4.6/bits/stl_function.h:486:12: instantiated from ‘std::_Select1st, boost::numeric::ublas::unbounded_array > > >, unsigned int> >’
/usr/include/c++/4.6/bits/hashtable_policy.h:789:20: instantiated from ‘std::__detail::_Hash_code_base, boost::numeric::ublas::unbounded_array > > >, std::pair, boost::numeric::ublas::unbounded_array > > >, unsigned int>, std::_Select1st, boost::numeric::ublas::unbounded_array > > >, unsigned int> >, std::_Bind, boost::numeric::ublas::unbounded_array > >(std::_Placeholder, std::_Placeholder, unsigned int, unsigned int)>, std::_Bind, boost::numeric::ublas::unbounded_array > >(std::_Placeholder, unsigned int, unsigned int)>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, false>’
/usr/include/c++/4.6/bits/hashtable.h:105:11: instantiated from ‘std::_Hashtable, boost::numeric::ublas::unbounded_array > > >, std::pair, boost::numeric::ublas::unbounded_array > > >, unsigned int>, std::allocator, boost::numeric::ublas::unbounded_array > > >, unsigned int> >, std::_Select1st, boost::numeric::ublas::unbounded_array > > >, unsigned int> >, std::_Bind, boost::numeric::ublas::unbounded_array > >(std::_Placeholder, std::_Placeholder, unsigned int, unsigned int)>, std::_Bind, boost::numeric::ublas::unbounded_array > >(std::_Placeholder, unsigned int, unsigned int)>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, false, false, true>’
/usr/include/c++/4.6/bits/unordered_map.h:44:11: instantiated from ‘std::__unordered_map, boost::numeric::ublas::unbounded_array > > >, unsigned int, std::_Bind, boost::numeric::ublas::unbounded_array > >(std::_Placeholder, unsigned int, unsigned int)>, std::_Bind, boost::numeric::ublas::unbounded_array > >(std::_Placeholder, std::_Placeholder, unsigned int, unsigned int)>, std::allocator, boost::numeric::ublas::unbounded_array > > >, unsigned int> >, false>’
/usr/include/c++/4.6/bits/unordered_map.h:256:11: instantiated from ‘std::unordered_map, boost::numeric::ublas::unbounded_array > > >, unsigned int, std::_Bind, boost::numeric::ublas::unbounded_array > >(std::_Placeholder, unsigned int, unsigned int)>, std::_Bind, boost::numeric::ublas::unbounded_array > >(std::_Placeholder, std::_Placeholder, unsigned int, unsigned int)>, std::allocator, boost::numeric::ublas::unbounded_array > > >, unsigned int> > >’
./sal/alg/ehh.hpp:144:31: instantiated from ‘sal::ehh_results sal::compute_ehh(boost::numeric::ublas::matrix&, unsigned int) [with FloatType = double, T = unsigned int, F = boost::numeric::ublas::basic_row_major, A = boost::numeric::ublas::unbounded_array >]’
src/test/read_test.cpp:11:51: instantiated from here
/usr/include/c++/4.6/bits/stl_pair.h:92:11: error: ‘std::pair::first’ has incomplete type
/usr/include/boost/numeric/ublas/fwd.hpp:73:11: error: declaration of ‘const struct boost::numeric::ublas::matrix_row, boost::numeric::ublas::unbounded_array > > >’
If you want to hash a range of things, you need something like hash_combine(). I usually lift this function from Boost (surprisingly, it wasn't included in the standard!). Here's how I'd use it on std::arrays, and I trust you can manipulate this into something to work on matrix rows:
#include <array>
template <class T>
inline void hash_combine(std::size_t & seed, const T & v)
{
std::hash<T> hasher;
seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
}
namespace std
{
template<typename T, size_t N> struct hash<array<T, N>>
{
inline size_t operator()(const array<T, N> & a) const
{
size_t seed = 0;
for (size_t i = 0; i != N; ++i)
{
::hash_combine(seed, a[i]);
}
return seed;
}
};
}
(The above specialisation allows you to use std::unordered_set<std::array<int, 10>> etc.)
If the matrix rows don't come with an equality predicate, you could also add a specialization of std::equal_to for matrix rows.