Всем привет
есть класс хочу в нем сделать видим символ string чтобы не писать вечно std::string
делаю так
struct test
{
using std::string;
void f(const string& var)
{
}
};
получаю
error C2886: 'std::string' : symbol cannot be used in a member using-declaration
делаю так
struct test
{
using namespace std;
void f(const string& var)
{
}
};
получаю
error C2059: syntax error : 'namespace'
в чем проблема и как добиться желаемого ?
struct test
{
typedef std::string string;
void f(const string& var)
{
}
};
единственный вариант ?
почему не работают два первых варианта ?
а как быть если символ это шаблон ? например
struct test
{
typedef msclr::interop::marshal_as marshal_as;
};
выдает
error C2146: syntax error : missing ';' before identifier 'marshal_as'
как быть в этом случае ?
можно как нить так указать ?
struct test
{
template<class any>
typedef msclr::interop::marshal_as<any> marshal_as<any>;
};
как быть ?
спасибо