Mogens Hansen wrote:
> "Martin M. Pedersen" <traxplayer@gmail.com> wrote in message
> news:4617bc26$0$52176$edfadb0f@dread11.news.tele.dk...
>
> [8<8<8<]
>> Hvad definerer jeg en unordered_set korrekt i dette tilfælde ?
>
> Jeg har ikke prøvet at bruge unordered_set, men du burde kunne skrive noget
> i retningen af:
>
> struct TraxboardHash
> {
> std::size_t operator()(const Traxboard& val)
> { return val.getHash(); }
> };
>
> unordered_set<Traxboard, TraxboardHash> traxboards;
>
Mange tak. Det hjalp mig lidt videre. Jeg får dog nu en kæmpe
fejl-besked, som jeg har pastet i bunden. Hvordan skal flg. forståes ?
namespace std {
namespace tr1 {
template <class Value,
class Hash = hash<Value>,
class Pred = std::equal_to<Value>,
class Alloc = std::allocator<Value> >
class unordered_set;
}
}
=====================================================
g++ -O3 -DDEBUG -Wall -Wunused -Wcast-qual -Wconversion
-Woverloaded-virtual -Werror -c openingbook.cpp
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/tr1/hashtable:
In member function ‘void std::tr1::hashtable<Key, Value, Allocator,
ExtractKey, Equal, H1, H2, H, RehashPolicy, cache_hash_code,
constant_iterators, unique_keys>::m_deallocate_node(Internal::hash_node
<Value, cache_hash_code>*) [with Key = Traxboard, Value = Traxboard,
Allocator = std::allocator<Traxboard>, ExtractKey =
Internal::identity<Traxboard>, Equal = std::equal_to<Traxboard>,
H1 = TraxboardHash, H2 = Internal::mod_range_hashing, H =
Internal::default_ranged_hash, RehashPolicy =
Internal::prime_rehash_policy, bool cache_hash_code = false, bool
constant_iterators = true, bool unique_keys = true]’:
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/tr1/hashtable:1341:
instantiated from ‘void std::tr1::hashtable<Key, Value, Allocator,
ExtractKey, Equal, H1, H2, H, RehashPolicy, cache_hash_code,
constant_iterators, unique_keys>::m_deallocate_nodes(Internal::ha
sh_node<Value, cache_hash_code>**, typename Allocator::size_type) [with
Key = Traxboard, Value = Traxboard, Allocator =
std::allocator<Traxboard>, ExtractKey = Internal::identity<Traxboa
rd>, Equal = std::equal_to<Traxboard>, H1 = TraxboardHash, H2 =
Internal::mod_range_hashing,
H = Internal::default_ranged_hash, RehashPolicy =
Internal::prime_rehash_policy, bool cache_h
ash_code = false, bool constant_iterators = true, bool unique_keys =
true]’/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/tr1/hashtable:1896:
instantiated from ‘void std::tr1::hashtable<Key, Value, Allocator,
ExtractKey, Equal, H1, H2, H, RehashPolicy, cache_hash_code,
constant_iterators, unique_keys>::clear() [with Key = Traxboard,
Value = Traxboard, Allocator = std::allocator<Traxboard>, ExtractKey =
Internal::identity<Traxboard>, Equal = std::equal_to<Traxboard>, H1 =
TraxboardHash, H2 = Internal::mod_range_hashing, H =
Internal::default_ranged_hash, RehashPolicy =
Internal::prime_rehash_policy, bool cache_hash_code = false, bool
constant_iterators = true, bool unique_keys = true]’
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/tr1/hashtable:1494:
instantiated from ‘std::tr1::hashtable<Key, Value, Allocator,
ExtractKey, Equal, H1, H2, H, RehashPolicy, cache_hash_code,
constant_iterators, unique_keys>:
hashtable() [with Key = Traxboard,
Value = Traxboard, Allocator = std::allocator<Traxboard>, ExtractKey =
Internal::identity<Traxboard>, Equal = std::equal_to<Traxboard>, H1 =
TraxboardHash, H2 = Internal::mod_range_hashing, H =
Internal::default_ranged_hash, RehashPolicy =
Internal::prime_rehash_policy, bool cache_hash_code = false, bool
constant_iterators = true, bool unique_keys = true]’
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/tr1/unordered_set:61:
instantiated from here
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/tr1/hashtable:1322:
error: invalid use of void expression
make: *** [openingbook.o] Error 1