Prev: conversion from `std::_List_iterator<int>' to non-scalar type `std::_List_iterator<int*>' requested
Next: Deleting a singleton object
From: Matthew Collett on 29 Jun 2010 17:08 In article <073c8b78-95bd-41bf-94b2-c64a86904dd0(a)j8g2000yqd.googlegroups.com>, Jag <jagnpu(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 ^^^ Typo here: 'list<int>::iterator' should obviously be 'list<T>::iterator'. > T& b) { > typename list<T>::iterator itt = a.begin() ; > while (itt != a.end()) { > if (*itt == b) { > break ; > } > itt++ ; > } > return itt ; > } If T were int* you would get almost, but not quite, the error your title reports; the return would need exactly the opposite conversion. Best wishes, Matthew -- http://homepages.ihug.co.nz/~m_collett [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] |