- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
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<openvdb::Vec3R>
and
it_rel_neigh->first
is of type
openvdb::Coord
I get an error as follows
tbb_structs1.h: In member function ‘void normals_unordered::operator()(const tbb::interface5::internal::concurrent_unordered_base<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> >::range_type&) const’: tbb_structs1.h:205:4: error: expected unqualified-id before ‘}’ token } ^ 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
Can someone kindly help me figure out why i get this error? Instead when i insert into a concurent_hash_map using a const_accessor the hash map and a declaration of the hasp map as follows
typedef tbb::concurrent_hash_map<openvdb::Coord, std::vector<openvdb::Vec3R>, MyHashCompare> vec_of_coords;
works fine.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Rohit,
The following message says about some problem near line #205 in tbb_structs1.h:
tbb_structs1.h:205:4: error: expected unqualified-id before ‘}’ token
Could you share the file or provide a code snippet near this line, please?
Regards,
Alex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI Alex
I apologize it seems i did a mistake in pasting the error the error is like this
rohit@rohit-desktop-work:~/Documents/openvdb_codes$ 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
I apologize once again. Kindly suggest what could be the issue with the error above.
Rohit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
/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&)’
According to the error message the object of the anotherHashCompare class does not have an appropriate operator() for the object of the openvdb::v4_0_1::math::Coord type. It can be caused if anotherHashCompare::operator() is not const.
Regards,
Alex
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page