[ create a new paste ] login | about

Link: http://codepad.org/GSCVOVj1    [ raw code | fork ]

C++, pasted on May 14:
class Foo
{
public:
    unsigned int ID;
};

template <class Object> class Cont
{
    public:
       Cont() {}
       Object* get( unsigned int nID )
       {
           typename std::map <unsigned int, Object*>::iterator it = m.begin(); // error here "expected ; before it" what is this error?

           for ( ; it != m.end(); it++ ) 
           {
               if ( (*it).second->ID == nID ) { return (*it).second; }
           }

           return NULL;
       }

       std::map <unsigned int, Object*> m;
};

int main(int argc, char* argv[])
{
    Cont<Foo> c;
    c.get( 2 );
    return 0;
}


Output:
No errors or program output.


Create a new paste based on this one


Comments: