bank.cpp: In lambda function:
bank.cpp:36:5: error: there are no arguments to 'assert' that depend on a template parameter, so a declaration of 'assert' must be available [-fpermissive]
36 | assert(b_sum == std::accumulate(bs.begin() + state[0], bs.end(), 0));
| ^~~~~~
bank.cpp:36:5: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
bank.cpp:37:36: error: no matching function for call to 'accumulate(std::array<int, 21>::const_iterator, std::array<int, 21>::const_iterator)'
37 | assert(a_sum == std::accumulate(state.begin() + 1, state.end()));
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/numeric:62,
from bank.cpp:6:
/usr/include/c++/11/bits/stl_numeric.h:134:5: note: candidate: 'template<class _InputIterator, class _Tp> constexpr _Tp std::accumulate(_InputIterator, _InputIterator, _Tp)'
134 | accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
| ^~~~~~~~~~
/usr/include/c++/11/bits/stl_numeric.h:134:5: note: template argument deduction/substitution failed:
bank.cpp:37:36: note: candidate expects 3 arguments, 2 provided
37 | assert(a_sum == std::accumulate(state.begin() + 1, state.end()));
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/numeric:62,
from bank.cpp:6:
/usr/include/c++/11/bits/stl_numeric.h:161:5: note: candidate: 'template<class _InputIterator, class _Tp, class _BinaryOperation> constexpr _Tp std::accumulate(_InputIterator, _InputIterator, _Tp, _BinaryOperation)'
161 | accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,
| ^~~~~~~~~~
/usr/include/c++/11/bits/stl_numeric.h:161:5: note: template argument deduction/substitution failed:
bank.cpp:37:36: note: candidate expects 4 arguments, 2 provided
37 | assert(a_sum == std::accumulate(state.begin() + 1, state.end()));
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:37:5: error: there are no arguments to 'assert' that depend on a template parameter, so a declaration of 'assert' must be available [-fpermissive]
37 | assert(a_sum == std::accumulate(state.begin() + 1, state.end()));
| ^~~~~~
bank.cpp: In instantiation of 'main()::<lambda(auto:16&&, const std::array<int, 21>&, int, int)> [with auto:16 = main()::<lambda(auto:16&&, const std::array<int, 21>&, int, int)>&]':
bank.cpp:70:19: required from here
bank.cpp:36:11: error: 'assert' was not declared in this scope
36 | assert(b_sum == std::accumulate(bs.begin() + state[0], bs.end(), 0));
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:7:1: note: 'assert' is defined in header '<cassert>'; did you forget to '#include <cassert>'?
6 | #include <numeric>
+++ |+#include <cassert>
7 |
bank.cpp:37:68: error: 'assert' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation
37 | assert(a_sum == std::accumulate(state.begin() + 1, state.end()));
| ^