Structs and classes

I wish to define a return value for a member function to be a struct defined within the class, however I do not want to use the class in the return value.

For example I currently have to do this:

 
ClassA::myStruct ClassA::f() { ... }


I want to do this:
 
myStruct ClassA::f() { ... }


Is this possible? If so, how do i do it?

Cheers!
-Caolan
> I do not want to use the class in the return value.
┬┐why not?
the name of your struct is ClassA::myStruct
Use an alias:
1
2
3
4
5
6
7
8
struct A { 
  struct B {};
  B f(); 
}; 

// Alias B as the nested class name A::B
using B = A::B; 
B A::f() { return {}; }
Registered users can post here. Sign in or register to post.