vendredi 30 septembre 2016

How do I access an alias declared inside struct/class scope?

Header.h

namespace some_name {
    struct foo {
        // using alias
        using MyMap = std::map<double, some_class* const>;
        MyMap* GetMap();
        MyMap* map_;
    }
}

Source.cpp

#include "Header.h"

// using declaration
using some_name::foo;

MyMap* foo::GetMap(){
    ...
    return map_;
}

But I get compiler error:

error: ‘MyMap’ does not name a type

MyMap* foo::GetMap() {

^

If I define the GetMap() in place in the header file everything works fine but if I move it to source file I get that error. What am I missing here?

Aucun commentaire:

Enregistrer un commentaire