prog.cpp: In instantiation of ‘typename std::iterator_traits<_Iterator>::reference access(It, It) [with It = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; typename std::iterator_traits<_Iterator>::reference = int&]’:
prog.cpp:14:30: required from here
prog.cpp:8:64: error: invalid initialization of non-const reference of type ‘std::__iterator_traits<__gnu_cxx::__normal_iterator<int*, std::vector<int> >, true>::reference {aka int&}’ from an rvalue of type ‘int’
return it == end? throw std::runtime_error("no element"): *it;
^
prog.cpp: In function ‘typename std::iterator_traits<_Iterator>::reference access(It, It) [with It = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; typename std::iterator_traits<_Iterator>::reference = int&]’:
prog.cpp:9:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^