Record Detail

Compile Error

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 = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]':
/in/driver/main.cpp:111:43:   required from here
/in/hashtable.hpp:410:42: error: no matching function for call to 'distance(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, std::_Fwd_list_iterator<std::pair<const int, int> >)'
         cout << "inserted at" << distance(buckets.begin(), next(it.listItBefore)) << endl;
                                  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/7/bits/stl_algobase.h:66: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_base_funcs.h:138:5: note: candidate: template<class _InputIterator> constexpr typename std::iterator_traits<_Iterator>::difference_type std::distance(_InputIterator, _InputIterator)
     distance(_InputIterator __first, _InputIterator __last)
     ^~~~~~~~
/usr/include/c++/7/bits/stl_iterator_base_funcs.h:138:5: note:   template argument deduction/substitution failed:
In file included from /in/driver/main.cpp:5:0:
/in/hashtable.hpp:410:42: note:   deduced conflicting types for parameter '_InputIterator' ('__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::_Fwd_list_iterator<std::pair<const int, int> >')
         cout << "inserted at" << distance(buckets.begin(), next(it.listItBefore)) << endl;
                                  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Information

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