例えば
struct A
{
static void foo();
static void foo(int);
static void foo(double, char);
...
};
そしてスコープ内
namespace nm
{
using A::foo; // not right
}
クラスの静的名をスコープに導入する方法は?
例えば
struct A
{
static void foo();
static void foo(int);
static void foo(double, char);
...
};
そしてスコープ内
namespace nm
{
using A::foo; // not right
}
クラスの静的名をスコープに導入する方法は?
それはいけません。
n3376 7.3.3/8
クラス メンバーの using 宣言は、メンバー宣言でなければなりません。
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
メンバー宣言として使用される using 宣言では、nested-name-specifier は、定義されているクラスの基本クラスに名前を付けるものとします。