Skip to content

Instantly share code, notes, and snippets.

@Mikle-Bond
Created August 30, 2019 11:09
Show Gist options
  • Save Mikle-Bond/74380b7cd4505f4ea95807ed3b8f5d3a to your computer and use it in GitHub Desktop.
Save Mikle-Bond/74380b7cd4505f4ea95807ed3b8f5d3a to your computer and use it in GitHub Desktop.
main.cpp: In function 'int main()':
main.cpp:10:58: error: no matching function for call to 'for_each_n(std::vector<int>::iterator, int, main()::<lambda(auto:1&)>)'
10 | std::for_each_n(ns.begin(), 3, [](auto& n){ n *= 2; });
| ^
In file included from /usr/local/include/c++/9.2.0/algorithm:71,
from main.cpp:1:
/usr/local/include/c++/9.2.0/pstl/glue_algorithm_defs.h:46:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Size, class _Function> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::for_each_n(_ExecutionPolicy&&, _ForwardIterator, _Size, _Function)'
46 | for_each_n(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Size __n, _Function __f);
| ^~~~~~~~~~
/usr/local/include/c++/9.2.0/pstl/glue_algorithm_defs.h:46:1: note: template argument deduction/substitution failed:
main.cpp:10:58: note: candidate expects 4 arguments, 3 provided
10 | std::for_each_n(ns.begin(), 3, [](auto& n){ n *= 2; });
| ^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment