I thought the new using
syntax in C++11 and typedef
were equivalent (except for templates). But it seems that with using
it is also not possible to declare a class member.
class A {
//... Public members
private:
typedef std::vector<double> vector_double;
using vector_int = std::vector<int>;
void bar(vector_double& vecDouble); // type can be used
void foo(vector_int& vecInt); // type can't be used: synatx error
// ... Possible other private members
}
When I try to use the type vector_int
in one of the member functions of class A I get a compiler error: syntax error: identifier 'vector_int'
.
Am I doing something wrong here or is defining a member type not possible with using
?