Boost C++ Libraries: Ticket #7821: Cannot user tuple in unordered_set https://svn.boost.org/trac10/ticket/7821 <p> Compiling this program: </p> <p> #include "boost/tuple/tuple.hpp" #include "boost/unordered_set.hpp" </p> <p> int main() { </p> <blockquote> <p> boost::unordered_set&lt;boost::tuple::tuple&lt;char&gt; &gt; tuples; </p> </blockquote> <blockquote> <p> return 0; </p> </blockquote> <p> } </p> <p> using g++ (GCC) 4.8.0 20121216 (experimental) and boost 1.52.0 fails with this error: </p> <p> In file included from /usr/include/boost/unordered/detail/table.hpp:10:0, </p> <blockquote> <p> from /usr/include/boost/unordered/detail/equivalent.hpp:14, from /usr/include/boost/unordered/unordered_set.hpp:17, from /usr/include/boost/unordered_set.hpp:16, from boost_tuple_hash.cpp:2: </p> </blockquote> <p> /usr/include/boost/unordered/detail/buckets.hpp: Jäsenfunktio ”void boost::unordered::detail::node_constructor&lt;<a class="missing wiki">NodeAlloc</a>&gt;::construct_with_value(const Args&amp;)”: /usr/include/boost/unordered/detail/buckets.hpp:338:13: virhe: ”construct_value_impl” is not a member of ”boost::unordered::detail” </p> <blockquote> <p> boost::unordered::detail::construct_value_impl( <sup> </sup></p> </blockquote> <p> /usr/include/boost/unordered/detail/buckets.hpp: Jäsenfunktio ”void boost::unordered::detail::node_constructor&lt;<a class="missing wiki">NodeAlloc</a>&gt;::construct_with_value2(const A0&amp;)”: /usr/include/boost/unordered/detail/buckets.hpp:347:13: virhe: ”construct_value_impl” is not a member of ”boost::unordered::detail” </p> <blockquote> <p> boost::unordered::detail::construct_value_impl( <sup> </sup></p> </blockquote> <p> /usr/include/boost/unordered/detail/buckets.hpp: In destructor ”boost::unordered::detail::node_constructor&lt;<a class="missing wiki">NodeAlloc</a>&gt;::~node_constructor()”: /usr/include/boost/unordered/detail/buckets.hpp:377:17: virhe: ”destroy_value_impl” is not a member of ”boost::unordered::detail” </p> <blockquote> <p> boost::unordered::detail::destroy_value_impl(alloc_, <sup> </sup></p> </blockquote> <p> /usr/include/boost/unordered/detail/buckets.hpp: Jäsenfunktio ”void boost::unordered::detail::node_constructor&lt;<a class="missing wiki">NodeAlloc</a>&gt;::construct()”: /usr/include/boost/unordered/detail/buckets.hpp:409:17: virhe: ”destroy_value_impl” is not a member of ”boost::unordered::detail” </p> <blockquote> <p> boost::unordered::detail::destroy_value_impl(alloc_, <sup> </sup></p> </blockquote> <p> /usr/include/boost/unordered/detail/buckets.hpp: In destructor ”boost::unordered::detail::node_holder&lt;<a class="missing wiki">NodeAlloc</a>&gt;::~node_holder()”: /usr/include/boost/unordered/detail/buckets.hpp:526:13: virhe: ”destroy_value_impl” is not a member of ”boost::unordered::detail” </p> <blockquote> <p> boost::unordered::detail::destroy_value_impl(this-&gt;alloc_, <sup> </sup></p> </blockquote> <p> /usr/include/boost/unordered/detail/buckets.hpp: At global scope: /usr/include/boost/unordered/detail/buckets.hpp:775:12: virhe: ”struct boost::unordered::detail::please_ignore_this_overload” uudelleenmääritelty </p> <blockquote> <p> struct please_ignore_this_overload { </p> <blockquote> <p> <sup> </sup></p> </blockquote> </blockquote> <p> In file included from /usr/include/boost/unordered/detail/buckets.hpp:15:0, </p> <blockquote> <p> from /usr/include/boost/unordered/detail/table.hpp:10, from /usr/include/boost/unordered/detail/equivalent.hpp:14, from /usr/include/boost/unordered/unordered_set.hpp:17, from /usr/include/boost/unordered_set.hpp:16, from boost_tuple_hash.cpp:2: </p> </blockquote> <p> /usr/include/boost/unordered/detail/allocate.hpp:177:12: virhe: previous definition of ”struct boost::unordered::detail::please_ignore_this_overload” </p> <blockquote> <p> struct please_ignore_this_overload { </p> <blockquote> <p> <sup> </sup></p> </blockquote> </blockquote> <p> In file included from /usr/include/boost/unordered/detail/table.hpp:10:0, </p> <blockquote> <p> from /usr/include/boost/unordered/detail/equivalent.hpp:14, from /usr/include/boost/unordered/unordered_set.hpp:17, from /usr/include/boost/unordered_set.hpp:16, from boost_tuple_hash.cpp:2: </p> </blockquote> <p> /usr/include/boost/unordered/detail/buckets.hpp:780:12: virhe: ”struct boost::unordered::detail::rv_ref_impl&lt;T&gt;” uudelleenmääritelty </p> <blockquote> <p> struct rv_ref_impl { </p> <blockquote> <p> <sup> </sup></p> </blockquote> </blockquote> <p> In file included from /usr/include/boost/unordered/detail/buckets.hpp:15:0, </p> <blockquote> <p> from /usr/include/boost/unordered/detail/table.hpp:10, from /usr/include/boost/unordered/detail/equivalent.hpp:14, from /usr/include/boost/unordered/unordered_set.hpp:17, from /usr/include/boost/unordered_set.hpp:16, from boost_tuple_hash.cpp:2: </p> </blockquote> <p> /usr/include/boost/unordered/detail/allocate.hpp:182:12: virhe: previous definition of ”struct boost::unordered::detail::rv_ref_impl&lt;T&gt;” </p> <blockquote> <p> struct rv_ref_impl { </p> <blockquote> <p> <sup> </sup></p> </blockquote> </blockquote> <p> In file included from /usr/include/boost/unordered/detail/table.hpp:10:0, </p> <blockquote> <p> from /usr/include/boost/unordered/detail/equivalent.hpp:14, from /usr/include/boost/unordered/unordered_set.hpp:17, from /usr/include/boost/unordered_set.hpp:16, from boost_tuple_hash.cpp:2: </p> </blockquote> <p> /usr/include/boost/unordered/detail/buckets.hpp:785:12: virhe: ”struct boost::unordered::detail::rv_ref&lt;T&gt;” uudelleenmääritelty </p> <blockquote> <p> struct rv_ref : </p> <blockquote> <p> <sup> </sup></p> </blockquote> </blockquote> <p> In file included from /usr/include/boost/unordered/detail/buckets.hpp:15:0, </p> <blockquote> <p> from /usr/include/boost/unordered/detail/table.hpp:10, from /usr/include/boost/unordered/detail/equivalent.hpp:14, from /usr/include/boost/unordered/unordered_set.hpp:17, from /usr/include/boost/unordered_set.hpp:16, from boost_tuple_hash.cpp:2: </p> </blockquote> <p> /usr/include/boost/unordered/detail/allocate.hpp:187:12: virhe: previous definition of ”struct boost::unordered::detail::rv_ref&lt;T&gt;” </p> <blockquote> <p> struct rv_ref : </p> <blockquote> <p> <sup> </sup></p> </blockquote> </blockquote> <p> In file included from /usr/include/boost/unordered/detail/equivalent.hpp:14:0, </p> <blockquote> <p> from /usr/include/boost/unordered/unordered_set.hpp:17, from /usr/include/boost/unordered_set.hpp:16, from boost_tuple_hash.cpp:2: </p> </blockquote> <p> /usr/include/boost/unordered/detail/table.hpp: Jäsenfunktio ”void boost::unordered::detail::table&lt;Types&gt;::delete_node(boost::unordered::detail::table&lt;Types&gt;::c_iterator)”: /usr/include/boost/unordered/detail/table.hpp:505:13: virhe: ”destroy_value_impl” is not a member of ”boost::unordered::detail” </p> <blockquote> <p> boost::unordered::detail::destroy_value_impl(node_alloc(), <sup> </sup></p> </blockquote> <p> boost_tuple_hash.cpp: Funktio ”int main()”: boost_tuple_hash.cpp:6:49: virhe: template argument 1 is invalid </p> <blockquote> <p> boost::unordered_set&lt;boost::tuple::tuple&lt;char&gt; &gt; tuples; </p> <blockquote> <p> <sup> </sup></p> </blockquote> </blockquote> <p> boost_tuple_hash.cpp:6:49: virhe: template argument 2 is invalid boost_tuple_hash.cpp:6:49: virhe: template argument 3 is invalid boost_tuple_hash.cpp:6:49: virhe: template argument 4 is invalid boost_tuple_hash.cpp:6:57: virhe: invalid type in declaration before ”;” token </p> <blockquote> <p> boost::unordered_set&lt;boost::tuple::tuple&lt;char&gt; &gt; tuples; </p> <blockquote> <p> <sup> </sup></p> </blockquote> </blockquote> <p> boost_tuple_hash.cpp:6:51: varoitus: käyttämätön muuttuja ”tuples” [-Wunused-variable] </p> <blockquote> <p> boost::unordered_set&lt;boost::tuple::tuple&lt;char&gt; &gt; tuples; </p> <blockquote> <p> <sup> </sup></p> </blockquote> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7821 Trac 1.4.3 Marshall Clow Fri, 21 Dec 2012 21:14:48 GMT <link>https://svn.boost.org/trac10/ticket/7821#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7821#comment:1</guid> <description> <p> works fine for me if you write: </p> <p> <code>boost::unordered_set &lt; boost::tuple&lt;char&gt; &gt; tuples;</code> </p> <p> instead of <code>boost::tuple::tuple</code> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Sat, 22 Dec 2012 08:36:51 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7821#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7821#comment:2</guid> <description> <p> If I use boost::unordered_set &lt; boost::tuple&lt;char&gt; &gt; tuples; the difference to the error above is that only the last 13 lines are removed: </p> <p> --- error 2012-12-21 20:52:15.000000000 +0200 +++ error2 2012-12-22 10:31:16.000000000 +0200 @@ -78,16 +78,3 @@ </p> <blockquote> <p> /usr/include/boost/unordered/detail/table.hpp:505:13: virhe: ”destroy_value_impl” is not a member of ”boost::unordered::detail” </p> <blockquote> <p> boost::unordered::detail::destroy_value_impl(node_alloc(), <sup> </sup></p> </blockquote> </blockquote> <p> -boost_tuple_hash.cpp: Funktio ”int main()”: -boost_tuple_hash.cpp:6:49: virhe: template argument 1 is invalid </p> <ul><li> boost::unordered_set&lt;boost::tuple::tuple&lt;char&gt; &gt; tuples; </li><li> <sup> </sup></li></ul><p> -boost_tuple_hash.cpp:6:49: virhe: template argument 2 is invalid -boost_tuple_hash.cpp:6:49: virhe: template argument 3 is invalid -boost_tuple_hash.cpp:6:49: virhe: template argument 4 is invalid -boost_tuple_hash.cpp:6:57: virhe: invalid type in declaration before ”;” token </p> <ul><li> boost::unordered_set&lt;boost::tuple::tuple&lt;char&gt; &gt; tuples; </li><li> <sup> </sup></li></ul><p> -boost_tuple_hash.cpp:6:51: varoitus: käyttämätön muuttuja ”tuples” [-Wunused-variable] </p> <ul><li> boost::unordered_set&lt;boost::tuple::tuple&lt;char&gt; &gt; tuples; </li><li> <sup> </sup></li></ul><p> I get almost the same error with gcc-4.7.2, with 4.6.1 I get for your version of the program: </p> <p> In file included from /usr/include/boost/unordered/detail/table.hpp:10:0, </p> <blockquote> <p> from /usr/include/boost/unordered/detail/equivalent.hpp:14, from /usr/include/boost/unordered/unordered_set.hpp:17, from /usr/include/boost/unordered_set.hpp:16, from boost_tuple_hash.cpp:2: </p> </blockquote> <p> /usr/include/boost/unordered/detail/buckets.hpp: Jäsenfunktio ”void boost::unordered::detail::node_constructor&lt;<a class="missing wiki">NodeAlloc</a>&gt;::construct_with_value(const Args&amp;)”: /usr/include/boost/unordered/detail/buckets.hpp:338:13: virhe: ”construct_value_impl” is not a member of ”boost::unordered::detail” /usr/include/boost/unordered/detail/buckets.hpp: Jäsenfunktio ”void boost::unordered::detail::node_constructor&lt;<a class="missing wiki">NodeAlloc</a>&gt;::construct_with_value2(const A0&amp;)”: /usr/include/boost/unordered/detail/buckets.hpp:347:13: virhe: ”construct_value_impl” is not a member of ”boost::unordered::detail” /usr/include/boost/unordered/detail/buckets.hpp: In destructor ”boost::unordered::detail::node_constructor&lt;<a class="missing wiki">NodeAlloc</a>&gt;::~node_constructor()”: /usr/include/boost/unordered/detail/buckets.hpp:377:17: virhe: ”destroy_value_impl” is not a member of ”boost::unordered::detail” /usr/include/boost/unordered/detail/buckets.hpp: Jäsenfunktio ”void boost::unordered::detail::node_constructor&lt;<a class="missing wiki">NodeAlloc</a>&gt;::construct()”: /usr/include/boost/unordered/detail/buckets.hpp:409:17: virhe: ”destroy_value_impl” is not a member of ”boost::unordered::detail” /usr/include/boost/unordered/detail/buckets.hpp: In destructor ”boost::unordered::detail::node_holder&lt;<a class="missing wiki">NodeAlloc</a>&gt;::~node_holder()”: /usr/include/boost/unordered/detail/buckets.hpp:526:13: virhe: ”destroy_value_impl” is not a member of ”boost::unordered::detail” /usr/include/boost/unordered/detail/buckets.hpp: At global scope: /usr/include/boost/unordered/detail/buckets.hpp:775:12: virhe: ”struct boost::unordered::detail::please_ignore_this_overload” uudelleenmääritelty /usr/include/boost/unordered/detail/allocate.hpp:177:12: virhe: previous definition of ”struct boost::unordered::detail::please_ignore_this_overload” /usr/include/boost/unordered/detail/buckets.hpp:780:12: virhe: ”struct boost::unordered::detail::rv_ref_impl&lt;T&gt;” uudelleenmääritelty /usr/include/boost/unordered/detail/allocate.hpp:182:12: virhe: previous definition of ”struct boost::unordered::detail::rv_ref_impl&lt;T&gt;” /usr/include/boost/unordered/detail/buckets.hpp:785:12: virhe: ”struct boost::unordered::detail::rv_ref&lt;T&gt;” uudelleenmääritelty /usr/include/boost/unordered/detail/allocate.hpp:187:12: virhe: previous definition of ”struct boost::unordered::detail::rv_ref&lt;T&gt;” In file included from /usr/include/boost/unordered/detail/equivalent.hpp:14:0, </p> <blockquote> <p> from /usr/include/boost/unordered/unordered_set.hpp:17, from /usr/include/boost/unordered_set.hpp:16, from boost_tuple_hash.cpp:2: </p> </blockquote> <p> /usr/include/boost/unordered/detail/table.hpp: Jäsenfunktio ”void boost::unordered::detail::table&lt;Types&gt;::delete_node(boost::unordered::detail::table&lt;Types&gt;::c_iterator)”: /usr/include/boost/unordered/detail/table.hpp:505:13: virhe: ”destroy_value_impl” is not a member of ”boost::unordered::detail” </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Sat, 22 Dec 2012 08:59:14 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7821#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7821#comment:3</guid> <description> <p> Hmm actually I get an error even with an empty main: </p> <p> #include "boost/unordered_set.hpp" </p> <p> #include "boost/tuple/tuple.hpp" </p> <p> main() {} </p> <p> error: </p> <p> In file included from /usr/include/boost/unordered/detail/table.hpp:10:0, </p> <blockquote> <p> from /usr/include/boost/unordered/detail/equivalent.hpp:14, from /usr/include/boost/unordered/unordered_set.hpp:17, from /usr/include/boost/unordered_set.hpp:16, from boost_tuple_hash.cpp:1: </p> </blockquote> <p> /usr/include/boost/unordered/detail/buckets.hpp: Jäsenfunktio ”void boost::unordered::detail::node_constructor&lt;<a class="missing wiki">NodeAlloc</a>&gt;::construct_with_value(const Args&amp;)”: /usr/include/boost/unordered/detail/buckets.hpp:338:13: virhe: ”construct_value_impl” is not a member of ”boost::unordered::detail” /usr/include/boost/unordered/detail/buckets.hpp: Jäsenfunktio ”void boost::unordered::detail::node_constructor&lt;<a class="missing wiki">NodeAlloc</a>&gt;::construct_with_value2(const A0&amp;)”: /usr/include/boost/unordered/detail/buckets.hpp:347:13: virhe: ”construct_value_impl” is not a member of ”boost::unordered::detail” /usr/include/boost/unordered/detail/buckets.hpp: In destructor ”boost::unordered::detail::node_constructor&lt;<a class="missing wiki">NodeAlloc</a>&gt;::~node_constructor()”: /usr/include/boost/unordered/detail/buckets.hpp:377:17: virhe: ”destroy_value_impl” is not a member of ”boost::unordered::detail” /usr/include/boost/unordered/detail/buckets.hpp: Jäsenfunktio ”void boost::unordered::detail::node_constructor&lt;<a class="missing wiki">NodeAlloc</a>&gt;::construct()”: /usr/include/boost/unordered/detail/buckets.hpp:409:17: virhe: ”destroy_value_impl” is not a member of ”boost::unordered::detail” /usr/include/boost/unordered/detail/buckets.hpp: In destructor ”boost::unordered::detail::node_holder&lt;<a class="missing wiki">NodeAlloc</a>&gt;::~node_holder()”: /usr/include/boost/unordered/detail/buckets.hpp:526:13: virhe: ”destroy_value_impl” is not a member of ”boost::unordered::detail” /usr/include/boost/unordered/detail/buckets.hpp: At global scope: /usr/include/boost/unordered/detail/buckets.hpp:775:12: virhe: ”struct boost::unordered::detail::please_ignore_this_overload” uudelleenmääritelty /usr/include/boost/unordered/detail/allocate.hpp:177:40: virhe: previous definition of ”struct boost::unordered::detail::please_ignore_this_overload” /usr/include/boost/unordered/detail/buckets.hpp:780:12: virhe: ”struct boost::unordered::detail::rv_ref_impl&lt;T&gt;” uudelleenmääritelty /usr/include/boost/unordered/detail/allocate.hpp:182:24: virhe: previous definition of ”struct boost::unordered::detail::rv_ref_impl&lt;T&gt;” /usr/include/boost/unordered/detail/buckets.hpp:785:12: virhe: ”struct boost::unordered::detail::rv_ref&lt;T&gt;” uudelleenmääritelty /usr/include/boost/unordered/detail/allocate.hpp:194:5: virhe: previous definition of ”struct boost::unordered::detail::rv_ref&lt;T&gt;” In file included from /usr/include/boost/unordered/detail/equivalent.hpp:14:0, </p> <blockquote> <p> from /usr/include/boost/unordered/unordered_set.hpp:17, from /usr/include/boost/unordered_set.hpp:16, from boost_tuple_hash.cpp:1: </p> </blockquote> <p> /usr/include/boost/unordered/detail/table.hpp: Jäsenfunktio ”void boost::unordered::detail::table&lt;Types&gt;::delete_node(boost::unordered::detail::table&lt;Types&gt;::c_iterator)”: /usr/include/boost/unordered/detail/table.hpp:505:13: virhe: ”destroy_value_impl” is not a member of ”boost::unordered::detail” </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Daniel James</dc:creator> <pubDate>Sat, 22 Dec 2012 09:01:56 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7821#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7821#comment:4</guid> <description> <p> Well, experimental versions of compilers aren't really supported. Also, <code>boost::tuple</code> isn't going to work anyway, since it doesn't have any support for <code>boost::hash</code> - you'll need to use a custom hash function. </p> <p> Concerning your errors, I don't see them with gcc 4.7, so my guess is that something in your copy of boost has been corrupted. <code>boost/unordered/detail/allocate.hpp</code> is the most likely candidate, try comparing it to the file at <a class="ext-link" href="https://svn.boost.org/svn/boost/tags/release/Boost_1_52_0/boost/unordered/detail/allocate.hpp"><span class="icon">​</span>https://svn.boost.org/svn/boost/tags/release/Boost_1_52_0/boost/unordered/detail/allocate.hpp</a> </p> <p> If that doesn't help, try preprocessing your program, and attach the compressed output to this ticket. Also, how did you install boost? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Sat, 22 Dec 2012 09:37:34 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7821#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7821#comment:5</guid> <description> <p> I installed with: </p> <p> wget "<a class="ext-link" href="http://downloads.sourceforge.net/project/boost/boost/1.52.0/boost_1_52_0.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fboost%2Ffiles%2Fboost%2F1.52.0%2F&amp;ts=1356167607&amp;use_mirror=switch"><span class="icon">​</span>http://downloads.sourceforge.net/project/boost/boost/1.52.0/boost_1_52_0.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fboost%2Ffiles%2Fboost%2F1.52.0%2F&amp;ts=1356167607&amp;use_mirror=switch</a>" -O boost_1_52_0.tar.bz2 </p> <p> tar xf boost_1_52_0.tar.bz2 </p> <p> cd boost_1_52_0 </p> <p> ./bootstrap.sh </p> <p> echo "using mpi ;" &gt;&gt; ./tools/build/v2/user-config.jam </p> <p> ./b2 -j7 </p> <p> su -c './b2 install --prefix=/usr' </p> <p> I compared my allocate to the one in svn and there were differences. Turns out that when installing no headers were actually copied (but libraries were) so the previous ones were kept. I deleted /usr/include/boost and now the version with empty main compiles. Thanks all. Any chance to get support for hash in tuple? There seems to be some need for it: </p> <p> <a class="ext-link" href="http://stackoverflow.com/questions/3611951/building-an-unordered-map-with-tuples-as-keys"><span class="icon">​</span>http://stackoverflow.com/questions/3611951/building-an-unordered-map-with-tuples-as-keys</a> </p> <p> <a class="ext-link" href="http://stackoverflow.com/questions/1250599/how-to-unordered-settupleint-int"><span class="icon">​</span>http://stackoverflow.com/questions/1250599/how-to-unordered-settupleint-int</a> </p> <p> <a class="ext-link" href="http://boost.2283326.n4.nabble.com/tuple-hash-Hashing-a-tuple-question-td2579220.html"><span class="icon">​</span>http://boost.2283326.n4.nabble.com/tuple-hash-Hashing-a-tuple-question-td2579220.html</a> </p> </description> <category>Ticket</category> </item> </channel> </rss>