Record Detail

Compile Error

/in/driver/main.cpp: In function 'int main(int, char**)':
/in/driver/main.cpp:63:5: error: conflicting declaration of C function 'int main(int, char**)'
 int main(int argc, char *argv[]) {
     ^~~~
In file included from /in/driver/main.cpp:5:0:
/in/hashtable.hpp:104:5: note: previous declaration 'int main()'
 int main() {
     ^~~~
/in/driver/main.cpp:78:33: error: 'class HashTableTest<int, int>' has no member named 'bucketSize'; did you mean 'buckets'?
     size_t hashTableSize = Test.bucketSize();
                                 ^~~~~~~~~~
                                 buckets
/in/driver/main.cpp:92:26: error: 'class HashTableTest<int, int>' has no member named 'contains'
                 if (Test.contains(key)){
                          ^~~~~~~~
/in/driver/main.cpp:101:44: error: 'class HashTableTest<int, int>' has no member named 'end'; did you mean 'find'?
                 if (Test.find(key) != Test.end()){
                                            ^~~
                                            find
/in/driver/main.cpp:129:90: error: no match for 'operator[]' (operand types are 'HashTableTest<int, int>' and 'int')
                 message = "Accessed (" + std::to_string(key) + ", " + std::to_string(Test[key]) + "); ";
                                                                                          ^
/in/driver/main.cpp:130:21: error: no match for 'operator[]' (operand types are 'HashTableTest<int, int>' and 'int')
                 Test[key] = value;
                     ^
/in/driver/main.cpp:131:93: error: no match for 'operator[]' (operand types are 'HashTableTest<int, int>' and 'int')
                 message += "Updated to (" + std::to_string(key) + ", " + std::to_string(Test[key]) + ").";;
                                                                                             ^
/in/driver/main.cpp:139:18: error: 'class HashTableTest<int, int>' has no member named 'bucketSize'; did you mean 'buckets'?
         if (Test.bucketSize() != hashTableSize){
                  ^~~~~~~~~~
                  buckets
/in/driver/main.cpp:140:111: error: 'class HashTableTest<int, int>' has no member named 'bucketSize'; did you mean 'buckets'?
             message += " Rehashed table from " + std::to_string(hashTableSize) + " to " + std::to_string(Test.bucketSize()) + ".";
                                                                                                               ^~~~~~~~~~
                                                                                                               buckets
/in/driver/main.cpp:141:34: error: 'class HashTableTest<int, int>' has no member named 'bucketSize'; did you mean 'buckets'?
             hashTableSize = Test.bucketSize();
                                  ^~~~~~~~~~
                                  buckets
In file included from /in/driver/main.cpp:5:0:
/in/hashtable.hpp: In instantiation of 'bool HashTable<Key, Value, Hash, KeyEqual>::insert(const Key&, const Value&) [with Key = std::__cxx11::basic_string<char>; Value = int; Hash = std::hash<std::__cxx11::basic_string<char> >; KeyEqual = std::equal_to<std::__cxx11::basic_string<char> >]':
/in/hashtable.hpp:108:32:   required from here
/in/hashtable.hpp:60:44: error: conversion to 'double' from 'std::vector<std::forward_list<std::pair<const std::__cxx11::basic_string<char>, int>, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >, std::allocator<std::forward_list<std::pair<const std::__cxx11::basic_string<char>, int>, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > > > >::size_type {aka long unsigned int}' may alter its value [-Werror=conversion]
         if (static_cast<double>(tableSize) / buckets.size() > maxLoadFactor) {
/in/hashtable.hpp: In instantiation of 'double HashTable<Key, Value, Hash, KeyEqual>::loadFactor() const [with Key = std::__cxx11::basic_string<char>; Value = int; Hash = std::hash<std::__cxx11::basic_string<char> >; KeyEqual = std::equal_to<std::__cxx11::basic_string<char> >]':
/in/hashtable.hpp:125:58:   required from here
/in/hashtable.hpp:100:47: error: conversion to 'double' from 'std::vector<std::forward_list<std::pair<const std::__cxx11::basic_string<char>, int>, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >, std::allocator<std::forward_list<std::pair<const std::__cxx11::basic_string<char>, int>, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > > > >::size_type {aka long unsigned int}' may alter its value [-Werror=conversion]
         return static_cast<double>(tableSize) / buckets.size();
/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:60:44: error: conversion to 'double' from 'std::vector<std::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > >, std::allocator<std::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > > > >::size_type {aka long unsigned int}' may alter its value [-Werror=conversion]
         if (static_cast<double>(tableSize) / buckets.size() > maxLoadFactor) {
/in/driver/main.cpp: In instantiation of 'void HashTableTest<Key, Value, Hash, KeyEqual>::print() [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]':
/in/driver/main.cpp:150:20:   required from here
/in/driver/main.cpp:46:36: error: 'HashTable<int, int, std::hash<int>, std::equal_to<int> >::HashTableData HashTable<int, int, std::hash<int>, std::equal_to<int> >::buckets' is private within this context
         for (auto BucketIt = this->buckets.begin(); BucketIt != this->buckets.end(); BucketIt++){
                              ~~~~~~^~~~~~~
In file included from /in/driver/main.cpp:5:0:
/in/hashtable.hpp:20:19: note: declared private here
     HashTableData buckets;
                   ^~~~~~~
/in/driver/main.cpp:46:71: error: 'HashTable<int, int, std::hash<int>, std::equal_to<int> >::HashTableData HashTable<int, int, std::hash<int>, std::equal_to<int> >::buckets' is private within this context
         for (auto BucketIt = this->buckets.begin(); BucketIt != this->buckets.end(); BucketIt++){
                                                                 ~~~~~~^~~~~~~
In file included from /in/driver/main.cpp:5:0:
/in/hashtable.hpp:20:19: note: declared private here
     HashTableData buckets;
                   ^~~~~~~
In file included from /usr/include/c++/7/forward_list:40:0,
                 from /in/hashtable.hpp:3,
                 from /in/driver/main.cpp:5:
/usr/include/c++/7/bits/forward_list.tcc: At global scope:
/usr/include/c++/7/bits/forward_list.tcc:398:7: error: 'void std::forward_list<_Tp, _Alloc>::sort(_Comp) [with _Comp = HashTableTest<Key, Value, Hash, KeyEqual>::print() [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]::<lambda(const std::pair<int, int>&, const std::pair<int, int>&)>; _Tp = std::pair<const int, int>; _Alloc = std::allocator<std::pair<const int, int> >]', declared using local type 'HashTableTest<Key, Value, Hash, KeyEqual>::print() [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]::<lambda(const std::pair<int, int>&, const std::pair<int, int>&)>', is used but never defined [-fpermissive]
       forward_list<_Tp, _Alloc>::
       ^~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

Information

Submit By
Type
Submission
Homework
Project 2: Hashing
Language
C++
Submit At
2024-11-11 18:31:33
Judged At
2024-11-11 18:31:33
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes