Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Okay Let's get working (comments just allow so much).</p> <p>The problem stems from the invocation of the <code>find</code> method.</p> <p>The template elected is:</p> <pre><code>template&lt; typename CompatibleKey,typename CompatibleHash,typename CompatiblePred &gt; iterator find(const CompatibleKey&amp; k, const CompatibleHash&amp; hash, const CompatiblePred&amp; eq) const; </code></pre> <p>With:</p> <pre><code>KeyFromValue = composite_key&lt;...&gt; CompatibleKey = unique_property CompatibleHash = boost::hash&lt;KeyFromValue&gt; CompatiblePred = equal_to&lt;KeyFromValue&gt; </code></pre> <p>Apparently, the invocation <code>hash(k)</code> inside the <code>find</code> method fails for the reason cited (could not deduce...), this methods itself invokes:</p> <pre><code>template&lt;BOOST_MULTI_INDEX_CK_ENUM_PARAMS(typename Value)&gt; std::size_t operator()(const tuple&lt;BOOST_MULTI_INDEX_CK_ENUM_PARAMS(Value)&gt;&amp; x)const </code></pre> <p>(Don't be afraid by the macro, it's just some magic Boost.Preprocessor to enumerate the <code>Value</code> from 0 to 9)</p> <p>Now, from this we can see that the problem is that we try to build <code>tuple&lt;Value0, Value1, ..., Value9&gt;</code> from <code>CompatibleKey</code> ie <code>unique_property</code> and it does not work.</p> <p>I think you should try:</p> <pre><code>ProbLocByHugo::iterator pos = local_data_structure.get&lt;hugo&gt;().find(boost::make_tuple(tempy)); </code></pre> <p>Here is the example of <code>composite_key</code> from [Boost][1]:</p> <pre><code>file_system_by_name::iterator it=fs.find( boost::make_tuple(current_dir,dir)); boost::tie(it0,it1)=fs_by_size.equal_range( boost::make_tuple(current_dir)); </code></pre> <p>As you can see, any invocation of key usage leads to <code>make_tuple</code>.</p> <p>You could avoid this by providing the right conversion operator for your <code>unique_property</code> class.</p> <pre><code>operator boost::tuple&lt; int, std::vector&lt;int&gt; const&amp; &gt;() const { return boost::make_tuple(my_int, cref(my_vec)); } </code></pre> <p>Or perhaps a variation...</p> <p>I have to admit that I am a bit disappointed by this requirement, I would have expected that <code>find</code> would work seemlessly.</p> <p>[1] <a href="http://www.boost.org/doc/libs/1_40_0/libs/multi_index/example/composite_keys.cpp" rel="nofollow noreferrer">http://www.boost.org/doc/libs/1_40_0/libs/multi_index/example/composite_keys.cpp</a></p>
    singulars
    1. This table or related slice is empty.
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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