prog.cpp: In function ‘int main()’:
prog.cpp:13:52: error: no matching function for call to ‘advance(std::vector<int>::iterator, int&)’
auto first = std::advance(std::begin(my_vector), n);
^
In file included from /usr/include/c++/8/bits/stl_algobase.h:66,
from /usr/include/c++/8/bits/char_traits.h:39,
from /usr/include/c++/8/ios:40,
from /usr/include/c++/8/ostream:38,
from /usr/include/c++/8/iostream:39,
from prog.cpp:1:
/usr/include/c++/8/bits/stl_iterator_base_funcs.h:202:5: note: candidate: ‘void std::advance(_InputIterator&, _Distance) [with _InputIterator = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; _Distance = int]’ <near match>
advance(_InputIterator& __i, _Distance __n)
^~~~~~~
/usr/include/c++/8/bits/stl_iterator_base_funcs.h:202:5: note: conversion of argument 1 would be ill-formed:
prog.cpp:13:38: error: cannot bind non-const lvalue reference of type ‘__gnu_cxx::__normal_iterator<int*, std::vector<int> >&’ to an rvalue of type ‘std::vector<int>::iterator’ {aka ‘__gnu_cxx::__normal_iterator<int*, std::vector<int> >’}
auto first = std::advance(std::begin(my_vector), n);
~~~~~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/8/bits/locale_facets.h:48,
from /usr/include/c++/8/bits/basic_ios.h:37,
from /usr/include/c++/8/ios:44,
from /usr/include/c++/8/ostream:38,
from /usr/include/c++/8/iostream:39,
from prog.cpp:1:
/usr/include/c++/8/bits/streambuf_iterator.h:408:5: note: candidate: ‘template<class _CharT2, class _Distance> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, void>::__type std::advance(std::istreambuf_iterator<_CharT>&, _Distance)’
advance(istreambuf_iterator<_CharT>& __i, _Distance __n)
^~~~~~~
/usr/include/c++/8/bits/streambuf_iterator.h:408:5: note: template argument deduction/substitution failed:
prog.cpp:13:52: note: ‘std::vector<int>::iterator’ {aka ‘__gnu_cxx::__normal_iterator<int*, std::vector<int> >’} is not derived from ‘std::istreambuf_iterator<_CharT>’
auto first = std::advance(std::begin(my_vector), n);
^