Skip to content

Instantly share code, notes, and snippets.

@trajing
Created October 25, 2018 14:48
Show Gist options
  • Save trajing/6fea65e876b064db23b1d69dfc984ce0 to your computer and use it in GitHub Desktop.
Save trajing/6fea65e876b064db23b1d69dfc984ce0 to your computer and use it in GitHub Desktop.
c++ template error
factorial.cpp: In function ‘std::deque<int> pairwise_add(std::deque<int>, std::deque<int>)’:
factorial.cpp:11:24: error: could not convert ‘std::transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation) [with _IIter1 = std::_Deque_iterator<int, int&, int*>; _IIter2 = std::_Deque_iterator<int, int&, int*>; _OIter = std::_Deque_iterator<int, int&, int*>; _BinaryOperation = std::plus<int>](std::deque<_Tp, _Alloc>::end() [with _Tp = int; _Alloc = std::allocator<int>; std::deque<_Tp, _Alloc>::iterator = std::_Deque_iterator<int, int&, int*>](), std::deque<_Tp, _Alloc>::begin() [with _Tp = int; _Alloc = std::allocator<int>; std::deque<_Tp, _Alloc>::iterator = std::_Deque_iterator<int, int&, int*>](), std::deque<_Tp, _Alloc>::begin() [with _Tp = int; _Alloc = std::allocator<int>; std::deque<_Tp, _Alloc>::iterator = std::_Deque_iterator<int, int&, int*>](), (std::plus<int>(), std::plus<int>()))’ from ‘std::_Deque_iterator<int, int&, int*>’ to ‘std::deque<int>’
return std::transform(v1.begin(), v1.end(), v2.begin(), r.begin(), std::plus<int>());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment