Record Detail

Compile Error

In file included from /in/driver/main.cpp:5:0:
/in/hashtable.hpp: In member function 'void HashTable<Key, Value, Hash, KeyEqual>::rehash(size_t)':
/in/hashtable.hpp:381:17: error: 'Bucket' was not declared in this scope
     std::vector<Bucket> newBuckets(newBucketSize);
                 ^~~~~~
/in/hashtable.hpp:381:17: note: suggested alternative: 'buckets'
     std::vector<Bucket> newBuckets(newBucketSize);
                 ^~~~~~
                 buckets
/in/hashtable.hpp:381:23: error: template argument 1 is invalid
     std::vector<Bucket> newBuckets(newBucketSize);
                       ^
/in/hashtable.hpp:381:23: error: template argument 2 is invalid
/in/hashtable.hpp:382:37: error: request for member 'begin' in 'newBuckets', which is of non-class type 'int'
     auto firstNonEmpty = newBuckets.begin();
                                     ^~~~~
/in/hashtable.hpp:388:43: error: request for member 'begin' in 'newBuckets', which is of non-class type 'int'
             auto newBucketIt = newBuckets.begin() + hashKey(value.first);
                                           ^~~~~
/in/hashtable.hpp:400:75: error: 'Bucket' does not name a type; did you mean 'newBuckets'?
     firstBucketIt = std::find_if(buckets.begin(), buckets.end(), [](const Bucket &b) { return !b.empty(); });
                                                                           ^~~~~~
                                                                           newBuckets
/in/hashtable.hpp: In lambda function:
/in/hashtable.hpp:400:109: error: expected '{' before ';' token
     firstBucketIt = std::find_if(buckets.begin(), buckets.end(), [](const Bucket &b) { return !b.empty(); });
                                                                                                             ^
/in/hashtable.hpp: In member function 'void HashTable<Key, Value, Hash, KeyEqual>::rehash(size_t)':
/in/hashtable.hpp:400:109: error: expected ')' before ';' token
/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:251:5: error: no return statement in function returning non-void [-Werror=return-type]
     }
     ^
/in/hashtable.hpp:249:30: error: unused parameter 'key' [-Werror=unused-parameter]
     Iterator find(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:279:19:   required from '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:302:18:   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:381:25: error: conversion to 'int' from 'size_t {aka long unsigned int}' may alter its value [-Werror=conversion]
     std::vector<Bucket> newBuckets(newBucketSize);
                         ^~~~~~~~~~
/in/hashtable.hpp:399:13: error: no match for 'operator=' (operand types are 'HashTable<int, int, std::hash<int>, std::equal_to<int> >::HashTableData {aka 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> > > > >}' and 'std::remove_reference<int&>::type {aka int}')
     buckets = std::move(newBuckets);
     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/7/vector:69:0,
                 from /usr/include/c++/7/functional:61,
                 from /in/hashtable.hpp:4,
                 from /in/driver/main.cpp:5:
/usr/include/c++/7/bits/vector.tcc:179:5: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = std::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > >; _Alloc = std::allocator<std::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > > >]
     vector<_Tp, _Alloc>::
     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/vector.tcc:179:5: note:   no known conversion for argument 1 from 'std::remove_reference<int&>::type {aka int}' to 'const 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> > > > >&'
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/functional:61,
                 from /in/hashtable.hpp:4,
                 from /in/driver/main.cpp:5:
/usr/include/c++/7/bits/stl_vector.h:461:7: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = std::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > >; _Alloc = std::allocator<std::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > > >]
       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
       ^~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:461:7: note:   no known conversion for argument 1 from 'std::remove_reference<int&>::type {aka int}' to '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> > > > >&&'
/usr/include/c++/7/bits/stl_vector.h:482:7: note: candidate: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = std::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > >; _Alloc = std::allocator<std::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > > >]
       operator=(initializer_list<value_type> __l)
       ^~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:482:7: note:   no known conversion for argument 1 from 'std::remove_reference<int&>::type {aka int}' to 'std::initializer_list<std::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > > >'
cc1plus: all warnings being treated as errors

Information

Submit By
Type
Submission
Homework
Project 2: Hashing
Language
C++
Submit At
2024-07-07 21:28:54
Judged At
2024-07-07 21:28:54
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes