C++11 Member aliases

Hi !
In first, sorry for my english.

I've got a problem with member type definitions. Here is the situation :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class A;
 
// What am I supposed to write here
 
class Bar {
    fn(const Foo::Alias&); // using Alias but it's not defined yet
};
 
class Foo {
    Bar mBar;

    // the alias
    using Alias = A;
     
};

If Foo were a namespace, that wouldn't have been a problem. But it's a class, and I cannot partially define it. Does anybody have an idea ?

Thanks.
the C++11 alias here is indistinguishable from C++98 typedef, which is a known issue:
http://stackoverflow.com/questions/951234/forward-declaration-of-nested-types-classes-in-c discusses a couple workarounds
Last edited on
Why is the alias defined in Foo if it is used by Bar and Foo has a Bar? It should be defined in Bar, and Foo can just redefine its own based on Bar's if it needs to.
Thanks Cubbi. :)

Why is the alias defined in Foo if it is used by Bar and Foo has a Bar? It should be defined in Bar, and Foo can just redefine its own based on Bar's if it needs to.

In fact, my code is :
1
2
3
4
class Game {
public:
	using TimeUnit = chrono::duration<double>;
};

I wouldn't make sense if the alias were in another class. ;)
In your code I do not see a Bar member variable.
Topic archived. No new replies allowed.