Record Detail

Compile Error

In file included from /in/driver/main.cpp:5:0:
/in/hashtable.hpp: In lambda function:
/in/hashtable.hpp:272:66: error: 'this' was not captured for this lambda function
                                [&key](const auto& node) { return keyEqual(node.first, key); });
                                                                  ^~~~~~~~
/in/hashtable.hpp: In instantiation of 'HashTable<Key, Value, Hash, KeyEqual>::find(const Key&)::<lambda(const auto:1&)> [with auto:1 = std::pair<const int, int>; Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]':
/usr/include/c++/7/bits/predefined_ops.h:283:11:   required from 'bool __gnu_cxx::__ops::_Iter_pred<_Predicate>::operator()(_Iterator) [with _Iterator = std::_Fwd_list_iterator<std::pair<const int, int> >; _Predicate = HashTable<Key, Value, Hash, KeyEqual>::find(const Key&) [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]::<lambda(const auto:1&)>]'
/usr/include/c++/7/bits/stl_algo.h:104:42:   required from '_InputIterator std::__find_if(_InputIterator, _InputIterator, _Predicate, std::input_iterator_tag) [with _InputIterator = std::_Fwd_list_iterator<std::pair<const int, int> >; _Predicate = __gnu_cxx::__ops::_Iter_pred<HashTable<Key, Value, Hash, KeyEqual>::find(const Key&) [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]::<lambda(const auto:1&)> >]'
/usr/include/c++/7/bits/stl_algo.h:161:23:   required from '_Iterator std::__find_if(_Iterator, _Iterator, _Predicate) [with _Iterator = std::_Fwd_list_iterator<std::pair<const int, int> >; _Predicate = __gnu_cxx::__ops::_Iter_pred<HashTable<Key, Value, Hash, KeyEqual>::find(const Key&) [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]::<lambda(const auto:1&)> >]'
/usr/include/c++/7/bits/stl_algo.h:3932:28:   required from '_IIter std::find_if(_IIter, _IIter, _Predicate) [with _IIter = std::_Fwd_list_iterator<std::pair<const int, int> >; _Predicate = HashTable<Key, Value, Hash, KeyEqual>::find(const Key&) [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]::<lambda(const auto:1&)>]'
/in/hashtable.hpp:271:31:   required from '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:272:66: error: 'this' was not captured for this lambda function
/in/hashtable.hpp:272:66: error: invalid use of non-static data member 'HashTable<int, int, std::hash<int>, std::equal_to<int> >::keyEqual'
In file included from /in/driver/main.cpp:5:0:
/in/hashtable.hpp:138:14: note: declared here
     KeyEqual keyEqual;                                                      // key equal function instance
              ^~~~~~~~
In file included from /usr/include/c++/7/bits/stl_algobase.h:71: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/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_pred<_Predicate>::operator()(_Iterator) [with _Iterator = std::_Fwd_list_iterator<std::pair<const int, int> >; _Predicate = HashTable<Key, Value, Hash, KeyEqual>::find(const Key&) [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]::<lambda(const auto:1&)>]':
/usr/include/c++/7/bits/stl_algo.h:104:42:   required from '_InputIterator std::__find_if(_InputIterator, _InputIterator, _Predicate, std::input_iterator_tag) [with _InputIterator = std::_Fwd_list_iterator<std::pair<const int, int> >; _Predicate = __gnu_cxx::__ops::_Iter_pred<HashTable<Key, Value, Hash, KeyEqual>::find(const Key&) [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]::<lambda(const auto:1&)> >]'
/usr/include/c++/7/bits/stl_algo.h:161:23:   required from '_Iterator std::__find_if(_Iterator, _Iterator, _Predicate) [with _Iterator = std::_Fwd_list_iterator<std::pair<const int, int> >; _Predicate = __gnu_cxx::__ops::_Iter_pred<HashTable<Key, Value, Hash, KeyEqual>::find(const Key&) [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]::<lambda(const auto:1&)> >]'
/usr/include/c++/7/bits/stl_algo.h:3932:28:   required from '_IIter std::find_if(_IIter, _IIter, _Predicate) [with _IIter = std::_Fwd_list_iterator<std::pair<const int, int> >; _Predicate = HashTable<Key, Value, Hash, KeyEqual>::find(const Key&) [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]::<lambda(const auto:1&)>]'
/in/hashtable.hpp:271:31:   required from '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
/usr/include/c++/7/bits/predefined_ops.h:283:11: error: void value not ignored as it ought to be
  { return bool(_M_pred(*__it)); }
           ^~~~~~~~~~~~~~~~~~~~

Information

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