From: AnonMail2005 on
On Jun 29, 4: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
> T& b) {
> typename list<T>::iterator itt = a.begin() ;
> while (itt != a.end()) {
> if (*itt == b) {
> break ;
> }
> itt++ ;
>
> }
> return itt ;
> }
Your function return type in list<int>::iterator instead if
list<T>::iterator.

HTH


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: red floyd on
On Jun 29, 1: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
> T& b) {
> typename list<T>::iterator itt = a.begin() ;
> while (itt != a.end()) {
> if (*itt == b) {
> break ;
> }
> itt++ ;
>
> }
> return itt ;
> }
>

Your function is explicitly returning list<int>::iterator. However
itt is a a list<T>::iterator, and T may not be int.


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]