Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++: error "... is not derived from type ..."

template<typename T1, typename T2>
class Bimap {
public:
    class Data;
    typedef Data* DataP;    
    typedef std::multimap<T1, DataP> T1Map;
    typedef std::multimap<T2, DataP> T2Map;

    class Data {
    private:
        Bimap& bimap;
        T1Map::iterator it1;
        /*...*/
    };
};

This gives me this compile error:

error: type 'std::multimap<T1, Bimap<T1, T2>::Data*, std::less<_Key>, std::allocator<std::pair<const T1, Bimap<T1, T2>::Data*> > >' is not derived from type 'Bimap<T1, T2>::Data'

What does that mean? What is the problem here?

like image 686
Albert Avatar asked Sep 19 '10 15:09

Albert


1 Answers

make it:

typename T1Map::iterator it1;

http://www.parashift.com/c++-faq-lite/templates.html#faq-35.18

like image 135
Anycorn Avatar answered Sep 20 '22 03:09

Anycorn