Record Detail

Compile Error

In file included from /in/driver/main.cpp:5:0:
/in/hashtable.hpp: In member function 'bool HashTable<Key, Value, Hash, KeyEqual>::insert(HashTable<Key, Value, Hash, KeyEqual>::Iterator&, const Key&, const Value&)':
/in/hashtable.hpp:290:62: error: 'bucket' was not declared in this scope
         if(firstBucketIt == buckets.end() || firstBucketIt > bucket.begin() + i){
                                                              ^~~~~~
/in/hashtable.hpp:290:62: note: suggested alternative: 'buckets'
         if(firstBucketIt == buckets.end() || firstBucketIt > bucket.begin() + i){
                                                              ^~~~~~
                                                              buckets
/in/hashtable.hpp: In instantiation of 'bool HashTable<Key, Value, Hash, KeyEqual>::insert(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:308:22:   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:283:9: error: no matching function for call to 'std::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > >::insert_after(HashTable<int, int, std::hash<int>, std::equal_to<int> >::HashNode&, const int&, const int&)'
         (buckets[i]).insert_after((*it), key, value);
         ^
In file included from /usr/include/c++/7/forward_list:38:0,
                 from /in/hashtable.hpp:6,
                 from /in/driver/main.cpp:5:
/usr/include/c++/7/bits/forward_list.h:880:7: note: candidate: std::forward_list<_Tp, _Alloc>::iterator std::forward_list<_Tp, _Alloc>::insert_after(std::forward_list<_Tp, _Alloc>::const_iterator, const _Tp&) [with _Tp = std::pair<const int, int>; _Alloc = std::allocator<std::pair<const int, int> >; std::forward_list<_Tp, _Alloc>::iterator = std::_Fwd_list_iterator<std::pair<const int, int> >; std::forward_list<_Tp, _Alloc>::const_iterator = std::_Fwd_list_const_iterator<std::pair<const int, int> >]
       insert_after(const_iterator __pos, const _Tp& __val)
       ^~~~~~~~~~~~
/usr/include/c++/7/bits/forward_list.h:880:7: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/7/bits/forward_list.h:887:7: note: candidate: std::forward_list<_Tp, _Alloc>::iterator std::forward_list<_Tp, _Alloc>::insert_after(std::forward_list<_Tp, _Alloc>::const_iterator, _Tp&&) [with _Tp = std::pair<const int, int>; _Alloc = std::allocator<std::pair<const int, int> >; std::forward_list<_Tp, _Alloc>::iterator = std::_Fwd_list_iterator<std::pair<const int, int> >; std::forward_list<_Tp, _Alloc>::const_iterator = std::_Fwd_list_const_iterator<std::pair<const int, int> >]
       insert_after(const_iterator __pos, _Tp&& __val)
       ^~~~~~~~~~~~
/usr/include/c++/7/bits/forward_list.h:887:7: note:   candidate expects 2 arguments, 3 provided
In file included from /usr/include/c++/7/forward_list:40:0,
                 from /in/hashtable.hpp:6,
                 from /in/driver/main.cpp:5:
/usr/include/c++/7/bits/forward_list.tcc:259:5: note: candidate: std::forward_list<_Tp, _Alloc>::iterator std::forward_list<_Tp, _Alloc>::insert_after(std::forward_list<_Tp, _Alloc>::const_iterator, std::forward_list<_Tp, _Alloc>::size_type, const _Tp&) [with _Tp = std::pair<const int, int>; _Alloc = std::allocator<std::pair<const int, int> >; std::forward_list<_Tp, _Alloc>::iterator = std::_Fwd_list_iterator<std::pair<const int, int> >; std::forward_list<_Tp, _Alloc>::const_iterator = std::_Fwd_list_const_iterator<std::pair<const int, int> >; std::forward_list<_Tp, _Alloc>::size_type = long unsigned int]
     forward_list<_Tp, _Alloc>::
     ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/forward_list.tcc:259:5: note:   no known conversion for argument 1 from 'HashTable<int, int, std::hash<int>, std::equal_to<int> >::HashNode {aka std::pair<const int, int>}' to 'std::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > >::const_iterator {aka std::_Fwd_list_const_iterator<std::pair<const int, int> >}'
In file included from /usr/include/c++/7/forward_list:38:0,
                 from /in/hashtable.hpp:6,
                 from /in/driver/main.cpp:5:
/usr/include/c++/7/bits/forward_list.h:926:9: note: candidate: template<class _InputIterator, class> std::forward_list<_Tp, _Alloc>::iterator std::forward_list<_Tp, _Alloc>::insert_after(std::forward_list<_Tp, _Alloc>::const_iterator, _InputIterator, _InputIterator) [with _InputIterator = _InputIterator; <template-parameter-2-2> = <template-parameter-1-2>; _Tp = std::pair<const int, int>; _Alloc = std::allocator<std::pair<const int, int> >]
         insert_after(const_iterator __pos,
         ^~~~~~~~~~~~
/usr/include/c++/7/bits/forward_list.h:926:9: note:   template argument deduction/substitution failed:
In file included from /in/driver/main.cpp:5:0:
/in/hashtable.hpp:283:9: note:   cannot convert '(& it)->HashTable<int, int, std::hash<int>, std::equal_to<int> >::Iterator::operator*()' (type 'HashTable<int, int, std::hash<int>, std::equal_to<int> >::HashNode {aka std::pair<const int, int>}') to type 'std::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > >::const_iterator {aka std::_Fwd_list_const_iterator<std::pair<const int, int> >}'
         (buckets[i]).insert_after((*it), key, value);
         ^
In file included from /usr/include/c++/7/forward_list:38:0,
                 from /in/hashtable.hpp:6,
                 from /in/driver/main.cpp:5:
/usr/include/c++/7/bits/forward_list.h:945:7: note: candidate: std::forward_list<_Tp, _Alloc>::iterator std::forward_list<_Tp, _Alloc>::insert_after(std::forward_list<_Tp, _Alloc>::const_iterator, std::initializer_list<_Tp>) [with _Tp = std::pair<const int, int>; _Alloc = std::allocator<std::pair<const int, int> >; std::forward_list<_Tp, _Alloc>::iterator = std::_Fwd_list_iterator<std::pair<const int, int> >; std::forward_list<_Tp, _Alloc>::const_iterator = std::_Fwd_list_const_iterator<std::pair<const int, int> >]
       insert_after(const_iterator __pos, std::initializer_list<_Tp> __il)
       ^~~~~~~~~~~~
/usr/include/c++/7/bits/forward_list.h:945:7: note:   candidate expects 2 arguments, 3 provided
In file included from /in/driver/main.cpp:5:0:
/in/hashtable.hpp: In instantiation of 'HashTable<Key, Value, Hash, KeyEqual>::Iterator HashTable<Key, Value, Hash, KeyEqual>::erase(const HashTable<Key, Value, Hash, KeyEqual>::Iterator&) [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]':
/in/hashtable.hpp:323:14:   required from '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:345:35: error: no match for 'operator=' (operand types are '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> > > > >::iterator {aka __gnu_cxx::__normal_iterator<std::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > >*, 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::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > >::iterator {aka std::_Fwd_list_iterator<std::pair<const int, int> >}')
                     firstBucketIt = (buckets[i]).begin();
In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from /in/driver/main.cpp:1:
/usr/include/c++/7/bits/stl_iterator.h:763:11: note: candidate: constexpr __gnu_cxx::__normal_iterator<std::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > >*, 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> > > > > >& __gnu_cxx::__normal_iterator<std::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > >*, 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> > > > > >::operator=(const __gnu_cxx::__normal_iterator<std::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > >*, 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> > > > > >&)
     class __normal_iterator
           ^~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/stl_iterator.h:763:11: note:   no known conversion for argument 1 from 'std::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > >::iterator {aka std::_Fwd_list_iterator<std::pair<const int, int> >}' to 'const __gnu_cxx::__normal_iterator<std::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > >*, 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_iterator.h:763:11: note: candidate: constexpr __gnu_cxx::__normal_iterator<std::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > >*, 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> > > > > >& __gnu_cxx::__normal_iterator<std::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > >*, 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> > > > > >::operator=(__gnu_cxx::__normal_iterator<std::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > >*, 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_iterator.h:763:11: note:   no known conversion for argument 1 from 'std::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > >::iterator {aka std::_Fwd_list_iterator<std::pair<const int, int> >}' to '__gnu_cxx::__normal_iterator<std::forward_list<std::pair<const int, int>, std::allocator<std::pair<const int, int> > >*, 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 /in/driver/main.cpp:5:0:
/in/hashtable.hpp: In member function 'bool HashTable<Key, Value, Hash, KeyEqual>::insert(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:293: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:48:15
Judged At
2024-11-13 22:48:15
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes