I wish to use concurrent_unordered_map with some custom types
I declare the unordered map as follows
typedef tbb::concurrent_unordered_map<openvdb::Coord, std::vector<openvdb::Vec3R>, anotherHashCompare> unordrd_vox_coordlist;
where another hash compare is defined as
struct anotherHashCompare {
static size_t hash( const openvdb::Coord &x ) {
size_t h = 0;
int s;
s=x.x();
h = (h*17)^s;
s=x.y();
h = (h*17)^s;
s=x.z();
h = (h*17)^s;
return ((size_t)h);
}
//! True if strings are equal
static bool equal( const openvdb::Coord &x, const openvdb::Coord &y ) {
return x==y;
}
};
Now when i want to insert something into this map object
unordrd_vox_coordlist intrmd_nrmls;
like this
intrmd_nrmls.insert(std::make_pair(it_rel_neigh->first,per_vox_intermed_nrmls));
where
per_vox_intermed_nrmls
is of type
std::vector
and
it_rel_neigh->first
is of type
openvdb::Coord
I get an error as follows
$ make
g++ -O3 -fPIC -fopenmp -std=c++11 -pthread -I./ -I/usr/local/include/eigen3 -I/home/rohit/openvdb/include -I/usr/local/include -I/home/rohit/Downloads/tbb2017_20170226oss/include -I/usr/local/include -o pointsv9.o -c pointsv9.cpp
In file included from /home/rohit/Downloads/tbb2017_20170226oss/include/tbb/concurrent_hash_map.h:47:0,
from /home/rohit/openvdb/include/openvdb/tree/Tree.h:51,
from /home/rohit/openvdb/include/openvdb/Grid.h:39,
from /home/rohit/openvdb/include/openvdb/openvdb.h:39,
from tbb_structs1.h:16,
from pointsv9.cpp:6:
/home/rohit/Downloads/tbb2017_20170226oss/include/tbb/internal/_tbb_hash_compare_impl.h: In instantiation of ‘std::size_t tbb::interface5::internal::hash_compare<Key, Hasher, Key_equality>::operator()(const Key&) const [with Key = openvdb::v4_0_1::math::Coord; Hasher = anotherHashCompare; Key_equality = std::equal_to<openvdb::v4_0_1::math::Coord>; std::size_t = long unsigned int]’:
/home/rohit/Downloads/tbb2017_20170226oss/include/tbb/internal/_concurrent_unordered_impl.h:1276:53: required from ‘std::pair<typename tbb::interface5::internal::split_ordered_list<typename Traits::value_type, typename Traits::allocator_type>::iterator, bool> tbb::interface5::internal::concurrent_unordered_base<Traits>::internal_insert(ValueType&&, tbb::interface5::internal::concurrent_unordered_base<Traits>::nodeptr_t) [with AllowCreate = tbb::internal::bool_constant<true>; ValueType = std::pair<const openvdb::v4_0_1::math::Coord, std::vector<openvdb::v4_0_1::math::Vec3<double> > >; Traits = tbb::interface5::concurrent_unordered_map_traits<openvdb::v4_0_1::math::Coord, std::vector<openvdb::v4_0_1::math::Vec3<double> >, tbb::interface5::internal::hash_compare<openvdb::v4_0_1::math::Coord, anotherHashCompare, std::equal_to<openvdb::v4_0_1::math::Coord> >, tbb::tbb_allocator<std::pair<const openvdb::v4_0_1::math::Coord, std::vector<openvdb::v4_0_1::math::Vec3<double> > > >, false>; typename tbb::interface5::internal::split_ordered_list<typename Traits::value_type, typename Traits::allocator_type>::iterator = tbb::interface5::internal::solist_iterator<tbb::interface5::internal::split_ordered_list<std::pair<const openvdb::v4_0_1::math::Coord, std::vector<openvdb::v4_0_1::math::Vec3<double> > >, tbb::tbb_allocator<std::pair<const openvdb::v4_0_1::math::Coord, std::vector<openvdb::v4_0_1::math::Vec3<double> > > > >, std::pair<const openvdb::v4_0_1::math::Coord, std::vector<openvdb::v4_0_1::math::Vec3<double> > > >; tbb::interface5::internal::concurrent_unordered_base<Traits>::nodeptr_t = tbb::interface5::internal::split_ordered_list<std::pair<const openvdb::v4_0_1::math::Coord, std::vector<openvdb::v4_0_1::math::Vec3<double> > >, tbb::tbb_allocator<std::pair<const openvdb::v4_0_1::math::Coord, std::vector<openvdb::v4_0_1::math::Vec3<double> > > > >::node*]’
/home/rohit/Downloads/tbb2017_20170226oss/include/tbb/internal/_concurrent_unordered_impl.h:980:73: required from ‘std::pair<typename tbb::interface5::internal::split_ordered_list<typename Traits::value_type, typename Traits::allocator_type>::iterator, bool> tbb::interface5::internal::concurrent_unordered_base<Traits>::insert(tbb::interface5::internal::concurrent_unordered_base<Traits>::value_type&&) [with Traits = tbb::interface5::concurrent_unordered_map_traits<openvdb::v4_0_1::math::Coord, std::vector<openvdb::v4_0_1::math::Vec3<double> >, tbb::interface5::internal::hash_compare<openvdb::v4_0_1::math::Coord, anotherHashCompare, std::equal_to<openvdb::v4_0_1::math::Coord> >, tbb::tbb_allocator<std::pair<const openvdb::v4_0_1::math::Coord, std::vector<openvdb::v4_0_1::math::Vec3<double> > > >, false>; typename tbb::interface5::internal::split_ordered_list<typename Traits::value_type, typename Traits::allocator_type>::iterator = tbb::interface5::internal::solist_iterator<tbb::interface5::internal::split_ordered_list<std::pair<const openvdb::v4_0_1::math::Coord, std::vector<openvdb::v4_0_1::math::Vec3<double> > >, tbb::tbb_allocator<std::pair<const openvdb::v4_0_1::math::Coord, std::vector<openvdb::v4_0_1::math::Vec3<double> > > > >, std::pair<const openvdb::v4_0_1::math::Coord, std::vector<openvdb::v4_0_1::math::Vec3<double> > > >; tbb::interface5::internal::concurrent_unordered_base<Traits>::value_type = std::pair<const openvdb::v4_0_1::math::Coord, std::vector<openvdb::v4_0_1::math::Vec3<double> > >]’
tbb_structs1.h:202:83: required from here
/home/rohit/Downloads/tbb2017_20170226oss/include/tbb/internal/_tbb_hash_compare_impl.h:46:44: error: no match for call to ‘(const anotherHashCompare) (const openvdb::v4_0_1::math::Coord&)’
return ((size_t)my_hash_object(key));
^
common.mk:52: recipe for target 'pointsv9.o' failed
make: *** [pointsv9.o] Error 1
Kindly suggest how may i correct my definition of the has function
Aucun commentaire:
Enregistrer un commentaire