I'm trying to unlearn using namespace std, considering https://www.youtube.com/watch?v=MZqjl9HEPZ8
So I tried
// using namespace std;
struct Data
{
using std::shared_ptr;
shared_ptr<char[]> m_name = nullptr;
// std::shared_ptr<char[]> m_name = nullptr;
};
And from that I got
main.cpp:14:11: Using declaration in class refers into 'std::', which is not a class
It seems I cannot do using std::shared_ptr; inside class declaration?
Am I missing something or really need to type std::shared_ptr there?
From the C++ 17 Standard (10.3.3 The using declaration)
std::shared_ptris not a member of a base class of the classDatain your code example.So the compiler issues an error.
std:;shared_ptris a class declared in the namespacestd. It is not even a member of some class.