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:283:33: error: expected primary-expression before 'const'
         buckets[i].insert_after(const buckets[i].before_begin(), key, value);
                                 ^~~~~
/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:324: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:346: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 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:287:19:   required from '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:309: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:388:26: error: conversion 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> > > > >::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> > > > > >}' to non-scalar type 'HashTable<int, int, std::hash<int>, std::equal_to<int> >::Iterator' requested
         for (Iterator it=firstBucketIt; !it.endFlag; it++) {
                          ^~~~~~~~~~~~~
/in/hashtable.hpp:389:13: error: no matching function for call to 'HashTable<int, int, std::hash<int>, std::equal_to<int> >::insert(HashTable<int, int, std::hash<int>, std::equal_to<int> >::HashNode&, HashTable<int, int, std::hash<int>, std::equal_to<int> >::HashNode*)'
             newTable.insert((*it), &(*it));
             ^~~~~~~~
/in/hashtable.hpp:275:10: note: candidate: 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>]
     bool insert(Iterator &it, const Key &key, const Value &value) {
          ^~~~~~
/in/hashtable.hpp:275:10: note:   candidate expects 3 arguments, 2 provided
/in/hashtable.hpp:306:10: note: candidate: 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>]
     bool insert(const Key &key, const Value &value) {
          ^~~~~~
/in/hashtable.hpp:306:10: 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 'const int&'
/in/hashtable.hpp:392:13: error: lvalue required as left operand of assignment
         this=newTable;
         ~~~~^~~~~~~~~
/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:383: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:287:19:   required from '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:309: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:175:31: error: conversion to 'double' from 'long unsigned int' may alter its value [-Werror=conversion]
                 > std::floor((tableSize / maxLoadFactor))){
                               ^~~~~~~~~
/in/hashtable.hpp:175:17: error: conversion to 'double' from 'long unsigned int' may alter its value [-Werror=conversion]
                 > std::floor((tableSize / maxLoadFactor))){
cc1plus: all warnings being treated as errors

Information

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