multi_index_container and hash_key lookup with boost boost-1.33.1
Hi,
I have a problem with a hash-index to a member of type
std::vectorstd::strings. With boost 1.34 it compiles
and runs find, but it fails to compile with 1.33!
Unfortunately I do not have the luxury to change
boost-version. Is there any way around this?
I defined my multi_index_container like this:
typedef std::vectorstd::string keys_type;
struct entry_type
{
keys_type keys;
bool operator<(const entry_type& e) const
{ ... }
};
typedef boost::multi_index::multi_index_container<
entry_type,
mi::indexed_by<
mi::hashed_unique<
mi::tag
mi_entries_type;
And get the following compile-error (see the bottom):
/usr/bin/g++ -m64 -pipe -Wall -fPIC -O3 -DNDEBUG
-I../framework
-I/sitestat/src/nightly/2007-06-14/branches/rel-6-00/src/build/../../src/cgi
-I/sitestat/src/nightly/2007-06-14/branches/rel-6-00/src/build/../../src/zip_utils
-DBOOST_SP_USE_QUICK_ALLOCATOR -DBOOST_DISABLE_THREADS
-m64 -pipe -Wall -fPIC -O3 -DNDEBUG -c refper_key.cpp
-o release/refper_key.o
refper_key.cpp: In member function virtual
repgen::operator_base::error_code
repgen::refper_key::do_pre_eval():
refper_key.cpp:391: warning: unused variable cols
/usr/include/boost/functional/hash/hash.hpp: In static
member function static size_t
boost::hash_detail::call_hash<T>::call(const T&) [with
T = std::vector
----- Mensaje original -----
De: Andrej van der Zee
Hi,
I have a problem with a hash-index to a member of type std::vectorstd::strings. With boost 1.34 it compiles and runs find, but it fails to compile with 1.33! [...] typedef std::vectorstd::string keys_type;
struct entry_type { keys_type keys;
bool operator<(const entry_type& e) const { ... } }; [...] error: no matching function for call to ?hash_value(const std::vector<...>&)? [...]
Hi Andrej, to teach the compiler to hash vectors you've got
to include
Hi,
Thanks again for your quick reply.
Moreover, thanks a lot for this library! The strong
point is that one can define multiple indexes on
existing datastructures, without toughing the
datastructures itself. For example, when you want to
change a vector to a hash, its straightforward and
less error-prone to use boost::multi_index_container,
then rewriting your datastructures to key-value pairs
and using an std::map.
Cheers,
Andrej
--- "JOAQUIN LOPEZ MU?Z"
----- Mensaje original ----- De: Andrej van der Zee
Fecha: Jueves, Junio 14, 2007 7:10 pm Asunto: [Boost-users] multi_index_container and hash_key lookup with boostboost-1.33.1 Para: Boost-users@lists.boost.org Hi,
I have a problem with a hash-index to a member of type std::vectorstd::strings. With boost 1.34 it compiles and runs find, but it fails to compile with 1.33! [...] typedef std::vectorstd::string keys_type;
struct entry_type { keys_type keys;
bool operator<(const entry_type& e) const { ... } }; [...] error: no matching function for call to ?hash_value(const std::vector<...>&)? [...]
Hi Andrej, to teach the compiler to hash vectors you've got to include
. Starting from Boost 1.34, all the hash/*.hpp headers are deprecated and you should only use . Joaquín y López Muñoz Telefónica, Investigación y Desarrollo _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
___________________________________________________________ Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for your free account today http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.htm...
participants (2)
-
"JOAQUIN LOPEZ MU?Z"
-
Andrej van der Zee