c++11 - tbb unordered map hash function error -


i wish use concurrent_unordered_map custom types

i declare unordered map follows

typedef tbb::concurrent_unordered_map<openvdb::coord, std::vector<openvdb::vec3r>, anotherhashcompare> unordrd_vox_coordlist; 

where hash compare 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 equal static bool equal( const openvdb::coord &x, const openvdb::coord &y ) {     return x==y; } 

};

now when want insert 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 error 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 /home/rohit/downloads/tbb2017_20170226oss/include/tbb/concurrent_hash_map.h:47:0,                  /home/rohit/openvdb/include/openvdb/tree/tree.h:51,                  /home/rohit/openvdb/include/openvdb/grid.h:39,                  /home/rohit/openvdb/include/openvdb/openvdb.h:39,                  tbb_structs1.h:16,                  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 ‘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 ‘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 here /home/rohit/downloads/tbb2017_20170226oss/include/tbb/internal/_tbb_hash_compare_impl.h:46:44: error: no match call ‘(const anotherhashcompare) (const openvdb::v4_0_1::math::coord&)’          return ((size_t)my_hash_object(key));                                             ^ common.mk:52: recipe target 'pointsv9.o' failed make: *** [pointsv9.o] error 1 

kindly suggest how may correct definition of has function

i tried declaring 2 new structs pass definition produces similar errors

does mean should declare them

    struct myhashcpr_unordrd {     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 h;     }  };  struct myhasheqlty_unordrd {         //! true if strings equal     static bool equal( const openvdb::coord &x, const openvdb::coord &y ) {         return x==y;     } };  typedef tbb::concurrent_unordered_map<openvdb::coord, std::vector<openvdb::vec3r>, myhashcpr_unordrd,myhasheqlty_unordrd> unordrd_vec_of_coords; 

because produces following errors

error: no match call ‘(const myhasheqlty_unordrd) (const openvdb::v4_0_1::math::coord&, const openvdb::v4_0_1::math::coord&)’ return (!my_key_compare_object(key1, key2));

error: no match call ‘(const myhashcpr_unordrd) (const openvdb::v4_0_1::math::coord&)’ return ((size_t)my_hash_object(key));


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -