Record Detail

Compile Error

In file included from /in/driver/main.cpp:5:0:
/in/hashtable.hpp: In member function 'size_t HashTable<Key, Value, Hash, KeyEqual>::findMinimumBucketSize(size_t) const':
/in/hashtable.hpp:170:56: error: 'floor' is not a member of 'std'
         size_t requiredSize = static_cast<size_t>(std::floor(static_cast<double>(tableSize)/ static_cast<double>(maxLoadFactor)));
                                                        ^~~~~
In file included from /in/driver/main.cpp:5:0:
/in/hashtable.hpp: In member function 'bool HashTable<Key, Value, Hash, KeyEqual>::insert(const HashTable<Key, Value, Hash, KeyEqual>::Iterator&, const Key&, const Value&)':
/in/hashtable.hpp:276:40: error: expression cannot be used as a function
         if (loadFactor()>maxLoadFactor())
                                        ^
/in/hashtable.hpp: In member function 'bool HashTable<Key, Value, Hash, KeyEqual>::insert(const Key&, const Value&)':
/in/hashtable.hpp:307:40: error: expression cannot be used as a function
         if (loadFactor()>maxLoadFactor())
                                        ^
/in/hashtable.hpp: In member function 'bool HashTable<Key, Value, Hash, KeyEqual>::erase(const Key&)':
/in/hashtable.hpp:335:13: error: 'it' was not declared in this scope
         if (it.endFlag) return it;
             ^~
/in/hashtable.hpp:335:13: note: suggested alternative: 'int'
         if (it.endFlag) return it;
             ^~
             int
/in/hashtable.hpp:336:23: error: 'it' was not declared in this scope
         auto nextIt = it.listItBefore;
                       ^~
/in/hashtable.hpp:336:23: note: suggested alternative: 'int'
         auto nextIt = it.listItBefore;
                       ^~
                       int
/in/hashtable.hpp: In instantiation of '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:319:22: error: assignment of read-only member 'std::pair<const int, int>::first'
             it->first=key;
             ~~~~~~~~~^~~~
/in/hashtable.hpp: In instantiation of 'bool HashTable<Key, Value, Hash, KeyEqual>::erase(const Key&) [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]':
/in/driver/main.cpp:120:35:   required from here
/in/hashtable.hpp:334:27: error: unused parameter 'key' [-Werror=unused-parameter]
     bool erase(const Key &key) {
                           ^~~
/in/hashtable.hpp: In instantiation of 'void HashTable<Key, Value, Hash, KeyEqual>::rehash(size_t) [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>; size_t = long unsigned int]':
/in/hashtable.hpp:309:19:   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:394:17: error: 'copyFrom' was not declared in this scope
         copyFrom(new_table);
         ~~~~~~~~^~~~~~~~~~~
/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:369:19:   required from 'Value& HashTable<Key, Value, Hash, KeyEqual>::operator[](const Key&) [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]'
/in/driver/main.cpp:129:94:   required from here
/in/hashtable.hpp:282:13: error: passing 'const HashTable<int, int, std::hash<int>, std::equal_to<int> >::Iterator' as 'this' argument discards qualifiers [-fpermissive]
             it->second=value;
             ^~
In file included from /in/driver/main.cpp:5:0:
/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 file included from /in/driver/main.cpp:5:0:
/in/hashtable.hpp:287:13: error: passing 'const HashTable<int, int, std::hash<int>, std::equal_to<int> >::Iterator' as 'this' argument discards qualifiers [-fpermissive]
             it->first=key;
             ^~
In file included from /in/driver/main.cpp:5:0:
/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 file included from /in/driver/main.cpp:5:0:
/in/hashtable.hpp:287:22: error: assignment of read-only member 'std::pair<const int, int>::first'
             it->first=key;
             ~~~~~~~~~^~~~
/in/hashtable.hpp:288:13: error: passing 'const HashTable<int, int, std::hash<int>, std::equal_to<int> >::Iterator' as 'this' argument discards qualifiers [-fpermissive]
             it->second=value;
             ^~
In file included from /in/driver/main.cpp:5:0:
/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 file included from /in/driver/main.cpp:5:0:
/in/hashtable.hpp: In instantiation of 'size_t HashTable<Key, Value, Hash, KeyEqual>::findMinimumBucketSize(size_t) const [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>; size_t = long unsigned int]':
/in/hashtable.hpp:387:43:   required from 'void HashTable<Key, Value, Hash, KeyEqual>::rehash(size_t) [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>; size_t = long unsigned int]'
/in/hashtable.hpp:309:19:   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:176:20: error: no matching function for call to 'std::range_error::range_error()'
         throw std::range_error();
                    ^~~~~~~~~~~~~
In file included from /usr/include/c++/7/system_error:41:0,
                 from /usr/include/c++/7/bits/ios_base.h:46,
                 from /usr/include/c++/7/ios:42,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from /in/driver/main.cpp:1:
/usr/include/c++/7/stdexcept:235:14: note: candidate: std::range_error::range_error(const char*)
     explicit range_error(const char*) _GLIBCXX_TXN_SAFE;
              ^~~~~~~~~~~
/usr/include/c++/7/stdexcept:235:14: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/7/stdexcept:233:14: note: candidate: std::range_error::range_error(const string&)
     explicit range_error(const string& __arg) _GLIBCXX_TXN_SAFE;
              ^~~~~~~~~~~
/usr/include/c++/7/stdexcept:233:14: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/7/stdexcept:230:9: note: candidate: std::range_error::range_error(const std::range_error&)
   class range_error : public runtime_error
         ^~~~~~~~~~~
/usr/include/c++/7/stdexcept:230:9: note:   candidate expects 1 argument, 0 provided
cc1plus: all warnings being treated as errors

Information

Submit By
Type
Submission
Homework
Project 2: Hashing
Language
C++
Submit At
2024-11-13 22:57:44
Judged At
2024-11-13 22:57:44
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes