Opened 10 years ago
Last modified 10 years ago
#7821 new Bugs
Cannot user tuple in unordered_set
Reported by: | Owned by: | Daniel James | |
---|---|---|---|
Milestone: | To Be Determined | Component: | unordered |
Version: | Boost 1.52.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Compiling this program:
#include "boost/tuple/tuple.hpp" #include "boost/unordered_set.hpp"
int main() {
boost::unordered_set<boost::tuple::tuple<char> > tuples;
return 0;
}
using g++ (GCC) 4.8.0 20121216 (experimental) and boost 1.52.0 fails with this error:
In file included from /usr/include/boost/unordered/detail/table.hpp:10:0,
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:
/usr/include/boost/unordered/detail/buckets.hpp: Jäsenfunktio ”void boost::unordered::detail::node_constructor<NodeAlloc>::construct_with_value(const Args&)”: /usr/include/boost/unordered/detail/buckets.hpp:338:13: virhe: ”construct_value_impl” is not a member of ”boost::unordered::detail”
boost::unordered::detail::construct_value_impl(
/usr/include/boost/unordered/detail/buckets.hpp: Jäsenfunktio ”void boost::unordered::detail::node_constructor<NodeAlloc>::construct_with_value2(const A0&)”: /usr/include/boost/unordered/detail/buckets.hpp:347:13: virhe: ”construct_value_impl” is not a member of ”boost::unordered::detail”
boost::unordered::detail::construct_value_impl(
/usr/include/boost/unordered/detail/buckets.hpp: In destructor ”boost::unordered::detail::node_constructor<NodeAlloc>::~node_constructor()”: /usr/include/boost/unordered/detail/buckets.hpp:377:17: virhe: ”destroy_value_impl” is not a member of ”boost::unordered::detail”
boost::unordered::detail::destroy_value_impl(alloc_,
/usr/include/boost/unordered/detail/buckets.hpp: Jäsenfunktio ”void boost::unordered::detail::node_constructor<NodeAlloc>::construct()”: /usr/include/boost/unordered/detail/buckets.hpp:409:17: virhe: ”destroy_value_impl” is not a member of ”boost::unordered::detail”
boost::unordered::detail::destroy_value_impl(alloc_,
/usr/include/boost/unordered/detail/buckets.hpp: In destructor ”boost::unordered::detail::node_holder<NodeAlloc>::~node_holder()”: /usr/include/boost/unordered/detail/buckets.hpp:526:13: virhe: ”destroy_value_impl” is not a member of ”boost::unordered::detail”
boost::unordered::detail::destroy_value_impl(this->alloc_,
/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
struct please_ignore_this_overload {
In file included from /usr/include/boost/unordered/detail/buckets.hpp:15:0,
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:
/usr/include/boost/unordered/detail/allocate.hpp:177:12: virhe: previous definition of ”struct boost::unordered::detail::please_ignore_this_overload”
struct please_ignore_this_overload {
In file included from /usr/include/boost/unordered/detail/table.hpp:10:0,
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:
/usr/include/boost/unordered/detail/buckets.hpp:780:12: virhe: ”struct boost::unordered::detail::rv_ref_impl<T>” uudelleenmääritelty
struct rv_ref_impl {
In file included from /usr/include/boost/unordered/detail/buckets.hpp:15:0,
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:
/usr/include/boost/unordered/detail/allocate.hpp:182:12: virhe: previous definition of ”struct boost::unordered::detail::rv_ref_impl<T>”
struct rv_ref_impl {
In file included from /usr/include/boost/unordered/detail/table.hpp:10:0,
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:
/usr/include/boost/unordered/detail/buckets.hpp:785:12: virhe: ”struct boost::unordered::detail::rv_ref<T>” uudelleenmääritelty
struct rv_ref :
In file included from /usr/include/boost/unordered/detail/buckets.hpp:15:0,
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:
/usr/include/boost/unordered/detail/allocate.hpp:187:12: virhe: previous definition of ”struct boost::unordered::detail::rv_ref<T>”
struct rv_ref :
In file included from /usr/include/boost/unordered/detail/equivalent.hpp:14:0,
from /usr/include/boost/unordered/unordered_set.hpp:17, from /usr/include/boost/unordered_set.hpp:16, from boost_tuple_hash.cpp:2:
/usr/include/boost/unordered/detail/table.hpp: Jäsenfunktio ”void boost::unordered::detail::table<Types>::delete_node(boost::unordered::detail::table<Types>::c_iterator)”: /usr/include/boost/unordered/detail/table.hpp:505:13: virhe: ”destroy_value_impl” is not a member of ”boost::unordered::detail”
boost::unordered::detail::destroy_value_impl(node_alloc(),
boost_tuple_hash.cpp: Funktio ”int main()”: boost_tuple_hash.cpp:6:49: virhe: template argument 1 is invalid
boost::unordered_set<boost::tuple::tuple<char> > tuples;
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
boost::unordered_set<boost::tuple::tuple<char> > tuples;
boost_tuple_hash.cpp:6:51: varoitus: käyttämätön muuttuja ”tuples” [-Wunused-variable]
boost::unordered_set<boost::tuple::tuple<char> > tuples;
Change History (5)
follow-ups: 2 3 comment:1 by , 10 years ago
comment:2 by , 10 years ago
If I use boost::unordered_set < boost::tuple<char> > tuples; the difference to the error above is that only the last 13 lines are removed:
--- error 2012-12-21 20:52:15.000000000 +0200 +++ error2 2012-12-22 10:31:16.000000000 +0200 @@ -78,16 +78,3 @@
/usr/include/boost/unordered/detail/table.hpp:505:13: virhe: ”destroy_value_impl” is not a member of ”boost::unordered::detail”
boost::unordered::detail::destroy_value_impl(node_alloc(),
-boost_tuple_hash.cpp: Funktio ”int main()”: -boost_tuple_hash.cpp:6:49: virhe: template argument 1 is invalid
- boost::unordered_set<boost::tuple::tuple<char> > tuples;
-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
- boost::unordered_set<boost::tuple::tuple<char> > tuples;
-boost_tuple_hash.cpp:6:51: varoitus: käyttämätön muuttuja ”tuples” [-Wunused-variable]
- boost::unordered_set<boost::tuple::tuple<char> > tuples;
I get almost the same error with gcc-4.7.2, with 4.6.1 I get for your version of the program:
In file included from /usr/include/boost/unordered/detail/table.hpp:10:0,
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:
/usr/include/boost/unordered/detail/buckets.hpp: Jäsenfunktio ”void boost::unordered::detail::node_constructor<NodeAlloc>::construct_with_value(const Args&)”: /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<NodeAlloc>::construct_with_value2(const A0&)”: /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<NodeAlloc>::~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<NodeAlloc>::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<NodeAlloc>::~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<T>” uudelleenmääritelty /usr/include/boost/unordered/detail/allocate.hpp:182:12: virhe: previous definition of ”struct boost::unordered::detail::rv_ref_impl<T>” /usr/include/boost/unordered/detail/buckets.hpp:785:12: virhe: ”struct boost::unordered::detail::rv_ref<T>” uudelleenmääritelty /usr/include/boost/unordered/detail/allocate.hpp:187:12: virhe: previous definition of ”struct boost::unordered::detail::rv_ref<T>” In file included from /usr/include/boost/unordered/detail/equivalent.hpp:14:0,
from /usr/include/boost/unordered/unordered_set.hpp:17, from /usr/include/boost/unordered_set.hpp:16, from boost_tuple_hash.cpp:2:
/usr/include/boost/unordered/detail/table.hpp: Jäsenfunktio ”void boost::unordered::detail::table<Types>::delete_node(boost::unordered::detail::table<Types>::c_iterator)”: /usr/include/boost/unordered/detail/table.hpp:505:13: virhe: ”destroy_value_impl” is not a member of ”boost::unordered::detail”
comment:3 by , 10 years ago
Hmm actually I get an error even with an empty main:
#include "boost/unordered_set.hpp"
#include "boost/tuple/tuple.hpp"
main() {}
error:
In file included from /usr/include/boost/unordered/detail/table.hpp:10:0,
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:
/usr/include/boost/unordered/detail/buckets.hpp: Jäsenfunktio ”void boost::unordered::detail::node_constructor<NodeAlloc>::construct_with_value(const Args&)”: /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<NodeAlloc>::construct_with_value2(const A0&)”: /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<NodeAlloc>::~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<NodeAlloc>::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<NodeAlloc>::~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<T>” uudelleenmääritelty /usr/include/boost/unordered/detail/allocate.hpp:182:24: virhe: previous definition of ”struct boost::unordered::detail::rv_ref_impl<T>” /usr/include/boost/unordered/detail/buckets.hpp:785:12: virhe: ”struct boost::unordered::detail::rv_ref<T>” uudelleenmääritelty /usr/include/boost/unordered/detail/allocate.hpp:194:5: virhe: previous definition of ”struct boost::unordered::detail::rv_ref<T>” In file included from /usr/include/boost/unordered/detail/equivalent.hpp:14:0,
from /usr/include/boost/unordered/unordered_set.hpp:17, from /usr/include/boost/unordered_set.hpp:16, from boost_tuple_hash.cpp:1:
/usr/include/boost/unordered/detail/table.hpp: Jäsenfunktio ”void boost::unordered::detail::table<Types>::delete_node(boost::unordered::detail::table<Types>::c_iterator)”: /usr/include/boost/unordered/detail/table.hpp:505:13: virhe: ”destroy_value_impl” is not a member of ”boost::unordered::detail”
follow-up: 5 comment:4 by , 10 years ago
Well, experimental versions of compilers aren't really supported. Also, boost::tuple
isn't going to work anyway, since it doesn't have any support for boost::hash
- you'll need to use a custom hash function.
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. boost/unordered/detail/allocate.hpp
is the most likely candidate, try comparing it to the file at https://svn.boost.org/svn/boost/tags/release/Boost_1_52_0/boost/unordered/detail/allocate.hpp
If that doesn't help, try preprocessing your program, and attach the compressed output to this ticket. Also, how did you install boost?
comment:5 by , 10 years ago
I installed with:
wget "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&ts=1356167607&use_mirror=switch" -O boost_1_52_0.tar.bz2
tar xf boost_1_52_0.tar.bz2
cd boost_1_52_0
./bootstrap.sh
echo "using mpi ;" >> ./tools/build/v2/user-config.jam
./b2 -j7
su -c './b2 install --prefix=/usr'
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:
http://stackoverflow.com/questions/3611951/building-an-unordered-map-with-tuples-as-keys
http://stackoverflow.com/questions/1250599/how-to-unordered-settupleint-int
http://boost.2283326.n4.nabble.com/tuple-hash-Hashing-a-tuple-question-td2579220.html
works fine for me if you write:
boost::unordered_set < boost::tuple<char> > tuples;
instead of
boost::tuple::tuple