From: Jag on 29 Jun 2010 05:27 I don't understand. Can some one explain the issue here. Thanks ------------ template <typename T> static typename list<int>::iterator find_an_element(list<T>& a, const T& b) { typename list<T>::iterator itt = a.begin() ; while (itt != a.end()) { if (*itt == b) { break ; } itt++ ; } return itt ; } -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: marcin.sfider on 29 Jun 2010 21:42 On Jun 29, 10:27 pm, Jag <jag...(a)gmail.com> wrote: > I don't understand. Can some one explain the issue here. Thanks > ------------ > template <typename T> > static typename list<int>::iterator find_an_element(list<T>& a, const ^^^ should be T > T& b) { > typename list<T>::iterator itt = a.begin() ; > while (itt != a.end()) { > if (*itt == b) { > break ; > } > itt++ ; > > } > return itt ; > } > Cheers Sfider -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
|
Pages: 1 Prev: initializer_list members not being constexpr anymore Next: Learning Boost |