Record Detail

Compile Error

In file included from /in/driver/main.cpp:5:0:
/in/hashtable.hpp: In member function 'HashTable<Key, Value, Hash, KeyEqual>::Iterator HashTable<Key, Value, Hash, KeyEqual>::find(const Key&)':
/in/hashtable.hpp:243:41: error: 'backet' was not declared in this scope
         for (auto it=bucket.begin();it!=backet.end();it++){
                                         ^~~~~~
/in/hashtable.hpp:243:41: note: suggested alternative: 'bucket'
         for (auto it=bucket.begin();it!=backet.end();it++){
                                         ^~~~~~
                                         bucket
/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:270: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:301: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:329:13: error: 'it' was not declared in this scope
         if (it.endFlag) return it;
             ^~
/in/hashtable.hpp:329:13: note: suggested alternative: 'int'
         if (it.endFlag) return it;
             ^~
             int
/in/hashtable.hpp:330:23: error: 'it' was not declared in this scope
         auto nextIt = it.listItBefore;
                       ^~
/in/hashtable.hpp:330:23: note: suggested alternative: 'int'
         auto nextIt = it.listItBefore;
                       ^~
                       int
/in/hashtable.hpp: In instantiation of 'HashTable<Key, Value, Hash, KeyEqual>::Iterator HashTable<Key, Value, Hash, KeyEqual>::find(const Key&) [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]':
/in/driver/main.cpp:101:34:   required from here
/in/hashtable.hpp:246:20: error: 'struct std::_Fwd_list_iterator<std::pair<const int, int> >' has no member named 'endFlag'
                 it.endFlag=false;
                 ~~~^~~~~~~
/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:313: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:328: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:303: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:388: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:363: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:276: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/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:281: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/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:281:22: error: assignment of read-only member 'std::pair<const int, int>::first'
             it->first=key;
             ~~~~~~~~~^~~~
/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/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: 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:381: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:303: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:172:89: error: conversion to 'double' from 'size_t {aka long unsigned int}' may alter its value [-Werror=conversion]
             if (HashPrime::g_a_sizes[i]>bucketSize && HashPrime::g_a_sizes[i]>floor(size()/getMaxLoadFactor()))
                                                                                     ~~~~^~
/in/hashtable.hpp:172:84: error: 'floor' was not declared in this scope
             if (HashPrime::g_a_sizes[i]>bucketSize && HashPrime::g_a_sizes[i]>floor(size()/getMaxLoadFactor()))
                                                                               ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/in/hashtable.hpp:172:84: note: suggested alternative: 'float'
             if (HashPrime::g_a_sizes[i]>bucketSize && HashPrime::g_a_sizes[i]>floor(size()/getMaxLoadFactor()))
                                                                               ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                               float
/in/hashtable.hpp:177: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:55:26
Judged At
2024-11-13 22:55:26
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes