Record Detail

Compile Error

In file included from /in/driver/main.cpp:5:0:
/in/hashtable.hpp: In instantiation of 'bool HashTable<Key, Value, Hash, KeyEqual>::insert(const HashTable<Key, Value, Hash, KeyEqual>::Iterator&, const Key&, const Value&) [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]':
/in/hashtable.hpp:326:22:   required from 'bool HashTable<Key, Value, Hash, KeyEqual>::insert(const Key&, const Value&) [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]'
/in/driver/main.cpp:111:43:   required from here
/in/hashtable.hpp:295:37: error: passing 'const HashTable<int, int, std::hash<int>, std::equal_to<int> >::Iterator' as 'this' argument discards qualifiers [-fpermissive]
         if (!it.endFlag && keyEqual(it->operator->()->first, key))
                                     ^~
/in/hashtable.hpp:114:19: note:   in call to 'HashTable<Key, Value, Hash, KeyEqual>::HashNode* HashTable<Key, Value, Hash, KeyEqual>::Iterator::operator->() [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>; HashTable<Key, Value, Hash, KeyEqual>::HashNode = std::pair<const int, int>]'
         HashNode *operator->() {
                   ^~~~~~~~
/in/hashtable.hpp:295:49: error: 'HashTable<int, int, std::hash<int>, std::equal_to<int> >::HashNode {aka struct std::pair<const int, int>}' has no member named 'operator->'; did you mean 'operator='?
         if (!it.endFlag && keyEqual(it->operator->()->first, key))
                                     ~~~~~~~~~~~~^~
                                     operator=
/in/hashtable.hpp:297:13: error: passing 'const HashTable<int, int, std::hash<int>, std::equal_to<int> >::Iterator' as 'this' argument discards qualifiers [-fpermissive]
             it->operator->()->second = value;
             ^~
/in/hashtable.hpp:114:19: note:   in call to 'HashTable<Key, Value, Hash, KeyEqual>::HashNode* HashTable<Key, Value, Hash, KeyEqual>::Iterator::operator->() [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>; HashTable<Key, Value, Hash, KeyEqual>::HashNode = std::pair<const int, int>]'
         HashNode *operator->() {
                   ^~~~~~~~
/in/hashtable.hpp:297:25: error: 'HashTable<int, int, std::hash<int>, std::equal_to<int> >::HashNode {aka struct std::pair<const int, int>}' has no member named 'operator->'; did you mean 'operator='?
             it->operator->()->second = value;
             ~~~~~~~~~~~~^~
             operator=

Information

Submit By
Type
Submission
Homework
Project 2: Hashing
Language
C++
Submit At
2024-11-10 01:17:21
Judged At
2024-11-10 01:17:21
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes