Note that there are some explanatory texts on larger screens.

plurals
  1. POBoost Multi-Index with hashed_unique_index produces compiler error
    primarykey
    data
    text
    <p>I learned in <a href="https://stackoverflow.com/questions/1701022/boost-multi-index-composite-key-of-vector-and-int-for-hashed-indices">THIS THREAD</a> how a <code>hashed_unique&lt;&gt;</code> index can be used with a <code>composite_key</code> using an int and a <code>std::vector&lt;int&gt;</code>. But unfortunately the following code produces quite an error message: </p> <p><code>1&gt; boost/multi_index/hashed_index.hpp(439) : error C2784: 'size_t .. composite_key_hash&lt;...&gt;::operator ()(const boost::tuples::tuple&lt;...&gt; &amp;) const' :</code><strong>could not deduce template argument</strong><code>for 'const boost::tuples::tuple&lt;...&gt; &amp;' from 'const unique_property'</code> </p> <p>Here the code, does anyone know whats wrong? :-?</p> <pre><code> #include &lt;boost/multi_index_container.hpp&gt; #include &lt;boost/multi_index/hashed_index.hpp&gt; #include &lt;boost/multi_index/random_access_index.hpp&gt; #include &lt;boost/multi_index/mem_fun.hpp&gt; #include &lt;boost/multi_index/composite_key.hpp&gt; #include &lt;vector&gt; using boost::multi_index_container; using namespace boost::multi_index; class unique_property { private: int my_value; //the pair of int and std::vector&lt;int&gt; shall be unique int my_int; std::vector&lt;int&gt; my_vec; public: //stupid ctor (my_values are unique as well, but thats not the point here) unique_property(int input_value) : my_value(input_value), my_int(10), my_vec(my_int,my_value) {} int get_int() const {return my_int;} const std::vector&lt;int&gt; &amp; get_vec() const {return my_vec;} }; struct hugo{}; typedef multi_index_container&lt; unique_property, indexed_by&lt; hashed_unique&lt; tag&lt;hugo&gt; ,// indexed by my_int and every entry of my_vec composite_key&lt; unique_property, const_mem_fun&lt;unique_property,int,&amp;unique_property::get_int &gt;, const_mem_fun&lt;unique_property, const std::vector&lt;int&gt; &amp;,&amp;unique_property::get_vec &gt; &gt; &gt;, random_access&lt; &gt; &gt; &gt; property_locator; // for brevity typedef property_locator::index&lt;hugo&gt;::type ProbLocByHugo; void dummy_test() { property_locator local_data_structure; unique_property tempy(5); ProbLocByHugo::iterator pos = local_data_structure.get&lt;hugo&gt;().find(tempy); //if (pos == local_data_structure.get&lt;hugo&gt;().end() ) // local_data_structure.insert(tempy); //else //{ // local_data_structure.get&lt;hugo&gt;().replace(pos,tempy); //} } </code></pre> <p>The complete error messages are: </p> <pre><code> 1&gt;------ Build started: Project: buggy, Configuration: Debug Win32 ------ 1&gt;Compiling... 1&gt;c:\myPath\boost_1_37_0\include\boost-1_37\boost\multi_index\hashed_index.hpp(439) : error C2784: 'size_t boost::multi_index::composite_key_hash&lt;Hash0,Hash1,Hash2,Hash3,Hash4,Hash5,Hash6,Hash7,Hash8,Hash9&gt;::operator ()(const boost::tuples::tuple&lt;Value0,Value1,Value2,Value3,Value4,Value5,Value6,Value7,Value8,Value9&gt; &amp;) const' : could not deduce template argument for 'const boost::tuples::tuple&lt;Value0,Value1,Value2,Value3,Value4,Value5,Value6,Value7,Value8,Value9&gt; &amp;' from 'const unique_property' 1&gt; with 1&gt; [ 1&gt; Hash0=boost::hash&lt;int&gt;, 1&gt; Hash1=boost::hash&lt;const std::vector&lt;int&gt;&gt;, 1&gt; Hash2=boost::tuples::null_type, 1&gt; Hash3=boost::tuples::null_type, 1&gt; Hash4=boost::tuples::null_type, 1&gt; Hash5=boost::tuples::null_type, 1&gt; Hash6=boost::tuples::null_type, 1&gt; Hash7=boost::tuples::null_type, 1&gt; Hash8=boost::tuples::null_type, 1&gt; Hash9=boost::tuples::null_type 1&gt; ] 1&gt; c:\myPath\boost_1_37_0\include\boost-1_37\boost\multi_index\composite_key.hpp(1099) : see declaration of 'boost::multi_index::composite_key_hash&lt;Hash0,Hash1,Hash2,Hash3,Hash4,Hash5,Hash6,Hash7,Hash8,Hash9&gt;::operator ()' 1&gt; with 1&gt; [ 1&gt; Hash0=boost::hash&lt;int&gt;, 1&gt; Hash1=boost::hash&lt;const std::vector&lt;int&gt;&gt;, 1&gt; Hash2=boost::tuples::null_type, 1&gt; Hash3=boost::tuples::null_type, 1&gt; Hash4=boost::tuples::null_type, 1&gt; Hash5=boost::tuples::null_type, 1&gt; Hash6=boost::tuples::null_type, 1&gt; Hash7=boost::tuples::null_type, 1&gt; Hash8=boost::tuples::null_type, 1&gt; Hash9=boost::tuples::null_type 1&gt; ] 1&gt; c:\myPath\boost_1_37_0\include\boost-1_37\boost\multi_index\hashed_index.hpp(429) : see reference to function template instantiation 'boost::multi_index::detail::hashed_index_iterator&lt;Node,BucketArray&gt; boost::multi_index::detail::hashed_index&lt;KeyFromValue,Hash,Pred,SuperMeta,TagList,Category&gt;::find&lt;CompatibleKey,boost::hash&lt;T&gt;,std::equal_to&lt;_Ty&gt;&gt;(const CompatibleKey &amp;,const CompatibleHash &amp;,const CompatiblePred &amp;) const' being compiled 1&gt; with 1&gt; [ 1&gt; Node=boost::multi_index::detail::hashed_index_node&lt;boost::multi_index::detail::random_access_index_node&lt;boost::multi_index::detail::index_node_base&lt;unique_property,std::allocator&lt;unique_property&gt;&gt;&gt;&gt;, 1&gt; BucketArray=boost::multi_index::detail::bucket_array&lt;std::allocator&lt;unique_property&gt;&gt;, 1&gt; KeyFromValue=boost::multi_index::composite_key&lt;unique_property,boost::multi_index::const_mem_fun&lt;unique_property,int,unique_property::get_int&gt;,boost::multi_index::const_mem_fun&lt;unique_property,const std::vector&lt;int&gt; &amp;,unique_property::get_vec&gt;&gt;, 1&gt; Hash=boost::hash&lt;boost::multi_index::composite_key_result&lt;boost::multi_index::composite_key&lt;unique_property,boost::multi_index::const_mem_fun&lt;unique_property,int,unique_property::get_int&gt;,boost::multi_index::const_mem_fun&lt;unique_property,const std::vector&lt;int&gt; &amp;,unique_property::get_vec&gt;&gt;&gt;&gt;, 1&gt; Pred=std::equal_to&lt;boost::multi_index::composite_key_result&lt;boost::multi_index::composite_key&lt;unique_property,boost::multi_index::const_mem_fun&lt;unique_property,int,unique_property::get_int&gt;,boost::multi_index::const_mem_fun&lt;unique_property,const std::vector&lt;int&gt; &amp;,unique_property::get_vec&gt;&gt;&gt;&gt;, 1&gt; SuperMeta=boost::multi_index::detail::nth_layer&lt;1,unique_property,boost::multi_index::indexed_by&lt;boost::multi_index::hashed_unique&lt;boost::multi_index::tag&lt;hugo&gt;,boost::multi_index::composite_key&lt;unique_property,boost::multi_index::const_mem_fun&lt;unique_property,int,unique_property::get_int&gt;,boost::multi_index::const_mem_fun&lt;unique_property,const std::vector&lt;int&gt; &amp;,unique_property::get_vec&gt;&gt;&gt;,boost::multi_index::random_access&lt;&gt;&gt;,std::allocator&lt;unique_property&gt;&gt;, 1&gt; TagList=boost::mpl::vector1&lt;hugo&gt;, 1&gt; Category=boost::multi_index::detail::hashed_unique_tag, 1&gt; CompatibleKey=unique_property, 1&gt; T=boost::multi_index::composite_key_result&lt;boost::multi_index::composite_key&lt;unique_property,boost::multi_index::const_mem_fun&lt;unique_property,int,unique_property::get_int&gt;,boost::multi_index::const_mem_fun&lt;unique_property,const std::vector&lt;int&gt; &amp;,unique_property::get_vec&gt;&gt;&gt;, 1&gt; _Ty=boost::multi_index::composite_key_result&lt;boost::multi_index::composite_key&lt;unique_property,boost::multi_index::const_mem_fun&lt;unique_property,int,unique_property::get_int&gt;,boost::multi_index::const_mem_fun&lt;unique_property,const std::vector&lt;int&gt; &amp;,unique_property::get_vec&gt;&gt;&gt;, 1&gt; CompatibleHash=boost::hash&lt;boost::multi_index::composite_key_result&lt;boost::multi_index::composite_key&lt;unique_property,boost::multi_index::const_mem_fun&lt;unique_property,int,unique_property::get_int&gt;,boost::multi_index::const_mem_fun&lt;unique_property,const std::vector&lt;int&gt; &amp;,unique_property::get_vec&gt;&gt;&gt;&gt;, 1&gt; CompatiblePred=std::equal_to&lt;boost::multi_index::composite_key_result&lt;boost::multi_index::composite_key&lt;unique_property,boost::multi_index::const_mem_fun&lt;unique_property,int,unique_property::get_int&gt;,boost::multi_index::const_mem_fun&lt;unique_property,const std::vector&lt;int&gt; &amp;,unique_property::get_vec&gt;&gt;&gt;&gt; 1&gt; ] 1&gt; c:\documents and settings\amenge.dedekind\desktop\ggt_test\mem_rw_test.cpp(886) : see reference to function template instantiation 'boost::multi_index::detail::hashed_index_iterator&lt;Node,BucketArray&gt; boost::multi_index::detail::hashed_index&lt;KeyFromValue,Hash,Pred,SuperMeta,TagList,Category&gt;::find&lt;unique_property&gt;(const CompatibleKey &amp;) const' being compiled 1&gt; with 1&gt; [ 1&gt; Node=boost::multi_index::detail::hashed_index_node&lt;boost::multi_index::detail::random_access_index_node&lt;boost::multi_index::detail::index_node_base&lt;unique_property,std::allocator&lt;unique_property&gt;&gt;&gt;&gt;, 1&gt; BucketArray=boost::multi_index::detail::bucket_array&lt;std::allocator&lt;unique_property&gt;&gt;, 1&gt; KeyFromValue=boost::multi_index::composite_key&lt;unique_property,boost::multi_index::const_mem_fun&lt;unique_property,int,unique_property::get_int&gt;,boost::multi_index::const_mem_fun&lt;unique_property,const std::vector&lt;int&gt; &amp;,unique_property::get_vec&gt;&gt;, 1&gt; Hash=boost::hash&lt;boost::multi_index::composite_key_result&lt;boost::multi_index::composite_key&lt;unique_property,boost::multi_index::const_mem_fun&lt;unique_property,int,unique_property::get_int&gt;,boost::multi_index::const_mem_fun&lt;unique_property,const std::vector&lt;int&gt; &amp;,unique_property::get_vec&gt;&gt;&gt;&gt;, 1&gt; Pred=std::equal_to&lt;boost::multi_index::composite_key_result&lt;boost::multi_index::composite_key&lt;unique_property,boost::multi_index::const_mem_fun&lt;unique_property,int,unique_property::get_int&gt;,boost::multi_index::const_mem_fun&lt;unique_property,const std::vector&lt;int&gt; &amp;,unique_property::get_vec&gt;&gt;&gt;&gt;, 1&gt; SuperMeta=boost::multi_index::detail::nth_layer&lt;1,unique_property,boost::multi_index::indexed_by&lt;boost::multi_index::hashed_unique&lt;boost::multi_index::tag&lt;hugo&gt;,boost::multi_index::composite_key&lt;unique_property,boost::multi_index::const_mem_fun&lt;unique_property,int,unique_property::get_int&gt;,boost::multi_index::const_mem_fun&lt;unique_property,const std::vector&lt;int&gt; &amp;,unique_property::get_vec&gt;&gt;&gt;,boost::multi_index::random_access&lt;&gt;&gt;,std::allocator&lt;unique_property&gt;&gt;, 1&gt; TagList=boost::mpl::vector1&lt;hugo&gt;, 1&gt; Category=boost::multi_index::detail::hashed_unique_tag, 1&gt; CompatibleKey=unique_property 1&gt; ] 1&gt;c:\myPath\boost_1_37_0\include\boost-1_37\boost\multi_index\hashed_index.hpp(439) : error C2784: 'size_t boost::multi_index::composite_key_hash&lt;Hash0,Hash1,Hash2,Hash3,Hash4,Hash5,Hash6,Hash7,Hash8,Hash9&gt;::operator ()(const boost::multi_index::composite_key_result&lt;CompositeKey1&gt; &amp;) const' : could not deduce template argument for 'const boost::multi_index::composite_key_result&lt;CompositeKey1&gt; &amp;' from 'const unique_property' 1&gt; with 1&gt; [ 1&gt; Hash0=boost::hash&lt;int&gt;, 1&gt; Hash1=boost::hash&lt;const std::vector&lt;int&gt;&gt;, 1&gt; Hash2=boost::tuples::null_type, 1&gt; Hash3=boost::tuples::null_type, 1&gt; Hash4=boost::tuples::null_type, 1&gt; Hash5=boost::tuples::null_type, 1&gt; Hash6=boost::tuples::null_type, 1&gt; Hash7=boost::tuples::null_type, 1&gt; Hash8=boost::tuples::null_type, 1&gt; Hash9=boost::tuples::null_type 1&gt; ] 1&gt; c:\myPath\boost_1_37_0\include\boost-1_37\boost\multi_index\composite_key.hpp(1083) : see declaration of 'boost::multi_index::composite_key_hash&lt;Hash0,Hash1,Hash2,Hash3,Hash4,Hash5,Hash6,Hash7,Hash8,Hash9&gt;::operator ()' 1&gt; with 1&gt; [ 1&gt; Hash0=boost::hash&lt;int&gt;, 1&gt; Hash1=boost::hash&lt;const std::vector&lt;int&gt;&gt;, 1&gt; Hash2=boost::tuples::null_type, 1&gt; Hash3=boost::tuples::null_type, 1&gt; Hash4=boost::tuples::null_type, 1&gt; Hash5=boost::tuples::null_type, 1&gt; Hash6=boost::tuples::null_type, 1&gt; Hash7=boost::tuples::null_type, 1&gt; Hash8=boost::tuples::null_type, 1&gt; Hash9=boost::tuples::null_type 1&gt; ] 1&gt;c:\myPath\boost_1_37_0\include\boost-1_37\boost\multi_index\hashed_index.hpp(443) : error C2784: 'bool boost::multi_index::composite_key_equal_to&lt;Pred0,Pred1,Pred2,Pred3,Pred4,Pred5,Pred6,Pred7,Pred8,Pred9&gt;::operator ()(const boost::tuples::tuple&lt;Value0,Value1,Value2,Value3,Value4,Value5,Value6,Value7,Value8,Value9&gt; &amp;,const boost::multi_index::composite_key_result&lt;CompositeKey&gt; &amp;) const' : could not deduce template argument for 'const boost::tuples::tuple&lt;Value0,Value1,Value2,Value3,Value4,Value5,Value6,Value7,Value8,Value9&gt; &amp;' from 'const unique_property' 1&gt; with 1&gt; [ 1&gt; Pred0=std::equal_to&lt;int&gt;, 1&gt; Pred1=std::equal_to&lt;const std::vector&lt;int&gt;&gt;, 1&gt; Pred2=boost::tuples::null_type, 1&gt; Pred3=boost::tuples::null_type, 1&gt; Pred4=boost::tuples::null_type, 1&gt; Pred5=boost::tuples::null_type, 1&gt; Pred6=boost::tuples::null_type, 1&gt; Pred7=boost::tuples::null_type, 1&gt; Pred8=boost::tuples::null_type, 1&gt; Pred9=boost::tuples::null_type 1&gt; ] 1&gt; c:\myPath\boost_1_37_0\include\boost-1_37\boost\multi_index\composite_key.hpp(914) : see declaration of 'boost::multi_index::composite_key_equal_to&lt;Pred0,Pred1,Pred2,Pred3,Pred4,Pred5,Pred6,Pred7,Pred8,Pred9&gt;::operator ()' 1&gt; with 1&gt; [ 1&gt; Pred0=std::equal_to&lt;int&gt;, 1&gt; Pred1=std::equal_to&lt;const std::vector&lt;int&gt;&gt;, 1&gt; Pred2=boost::tuples::null_type, 1&gt; Pred3=boost::tuples::null_type, 1&gt; Pred4=boost::tuples::null_type, 1&gt; Pred5=boost::tuples::null_type, 1&gt; Pred6=boost::tuples::null_type, 1&gt; Pred7=boost::tuples::null_type, 1&gt; Pred8=boost::tuples::null_type, 1&gt; Pred9=boost::tuples::null_type 1&gt; ] 1&gt;c:\myPath\boost_1_37_0\include\boost-1_37\boost\multi_index\hashed_index.hpp(443) : error C2784: 'bool boost::multi_index::composite_key_equal_to&lt;Pred0,Pred1,Pred2,Pred3,Pred4,Pred5,Pred6,Pred7,Pred8,Pred9&gt;::operator ()(const boost::multi_index::composite_key_result&lt;CompositeKey1&gt; &amp;,const boost::tuples::tuple&lt;Value0,Value1,Value2,Value3,Value4,Value5,Value6,Value7,Value8,Value9&gt; &amp;) const' : could not deduce template argument for 'const boost::multi_index::composite_key_result&lt;CompositeKey1&gt; &amp;' from 'const unique_property' 1&gt; with 1&gt; [ 1&gt; Pred0=std::equal_to&lt;int&gt;, 1&gt; Pred1=std::equal_to&lt;const std::vector&lt;int&gt;&gt;, 1&gt; Pred2=boost::tuples::null_type, 1&gt; Pred3=boost::tuples::null_type, 1&gt; Pred4=boost::tuples::null_type, 1&gt; Pred5=boost::tuples::null_type, 1&gt; Pred6=boost::tuples::null_type, 1&gt; Pred7=boost::tuples::null_type, 1&gt; Pred8=boost::tuples::null_type, 1&gt; Pred9=boost::tuples::null_type 1&gt; ] 1&gt; c:\myPath\boost_1_37_0\include\boost-1_37\boost\multi_index\composite_key.hpp(889) : see declaration of 'boost::multi_index::composite_key_equal_to&lt;Pred0,Pred1,Pred2,Pred3,Pred4,Pred5,Pred6,Pred7,Pred8,Pred9&gt;::operator ()' 1&gt; with 1&gt; [ 1&gt; Pred0=std::equal_to&lt;int&gt;, 1&gt; Pred1=std::equal_to&lt;const std::vector&lt;int&gt;&gt;, 1&gt; Pred2=boost::tuples::null_type, 1&gt; Pred3=boost::tuples::null_type, 1&gt; Pred4=boost::tuples::null_type, 1&gt; Pred5=boost::tuples::null_type, 1&gt; Pred6=boost::tuples::null_type, 1&gt; Pred7=boost::tuples::null_type, 1&gt; Pred8=boost::tuples::null_type, 1&gt; Pred9=boost::tuples::null_type 1&gt; ] 1&gt;c:\myPath\boost_1_37_0\include\boost-1_37\boost\multi_index\hashed_index.hpp(443) : error C2784: 'bool boost::multi_index::composite_key_equal_to&lt;Pred0,Pred1,Pred2,Pred3,Pred4,Pred5,Pred6,Pred7,Pred8,Pred9&gt;::operator ()(const boost::multi_index::composite_key_result&lt;CompositeKey1&gt; &amp;,const boost::multi_index::composite_key_result&lt;CompositeKey2&gt; &amp;) const' : could not deduce template argument for 'const boost::multi_index::composite_key_result&lt;CompositeKey1&gt; &amp;' from 'const unique_property' 1&gt; with 1&gt; [ 1&gt; Pred0=std::equal_to&lt;int&gt;, 1&gt; Pred1=std::equal_to&lt;const std::vector&lt;int&gt;&gt;, 1&gt; Pred2=boost::tuples::null_type, 1&gt; Pred3=boost::tuples::null_type, 1&gt; Pred4=boost::tuples::null_type, 1&gt; Pred5=boost::tuples::null_type, 1&gt; Pred6=boost::tuples::null_type, 1&gt; Pred7=boost::tuples::null_type, 1&gt; Pred8=boost::tuples::null_type, 1&gt; Pred9=boost::tuples::null_type 1&gt; ] 1&gt; c:\myPath\boost_1_37_0\include\boost-1_37\boost\multi_index\composite_key.hpp(859) : see declaration of 'boost::multi_index::composite_key_equal_to&lt;Pred0,Pred1,Pred2,Pred3,Pred4,Pred5,Pred6,Pred7,Pred8,Pred9&gt;::operator ()' 1&gt; with 1&gt; [ 1&gt; Pred0=std::equal_to&lt;int&gt;, 1&gt; Pred1=std::equal_to&lt;const std::vector&lt;int&gt;&gt;, 1&gt; Pred2=boost::tuples::null_type, 1&gt; Pred3=boost::tuples::null_type, 1&gt; Pred4=boost::tuples::null_type, 1&gt; Pred5=boost::tuples::null_type, 1&gt; Pred6=boost::tuples::null_type, 1&gt; Pred7=boost::tuples::null_type, 1&gt; Pred8=boost::tuples::null_type, 1&gt; Pred9=boost::tuples::null_type 1&gt; ] </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload