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 Key&, const Value&)':
/in/hashtable.hpp:305: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:333:13: error: 'it' was not declared in this scope
         if (it.endFlag) return it;
             ^~
/in/hashtable.hpp:333:13: note: suggested alternative: 'int'
         if (it.endFlag) return it;
             ^~
             int
/in/hashtable.hpp:334:23: error: 'it' was not declared in this scope
         auto nextIt = it.listItBefore;
                       ^~
/in/hashtable.hpp:334: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:317: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:332: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:307: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:392:17: error: 'copyFrom' was not declared in this scope
         copyFrom(new_table);
         ~~~~~~~~^~~~~~~~~~~
/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:385: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:307: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
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 [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]':
/in/hashtable.hpp:177:5: error: control reaches end of non-void function [-Werror=return-type]
     }
     ^
cc1plus: all warnings being treated as errors

Information

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