user1899020
user1899020

Reputation: 13575

How to introduce a static name in a class to a scope?

For example

struct A
{
    static void foo();
    static void foo(int);
    static void foo(double, char);
    ...
};

and in a scope

namespace nm
{
    using A::foo; // not right
}

How to introduce a static name in a class to a scope?

Upvotes: 2

Views: 57

Answers (1)

ForEveR
ForEveR

Reputation: 55887

You cannot.

n3376 7.3.3/8

A using-declaration for a class member shall be a member-declaration.

struct X {
int i;
static int s;
};
void f() {
   using X::i; // error: X::i is a class member
   // and this is not a member declaration.
   using X::s; // error: X::s is a class member
   //and this is not a member declaration.

}

n3376 7.3.3/3

In a using-declaration used as a member-declaration, the nested-name-specifier shall name a base class of the class being defined.

Upvotes: 1

Related Questions