Я реализовал синглтон в качестве встроенной переменной статического члена, но была проблема.(6): error C2512: 'A': no appropriate default constructor available
(1): note: see declaration of 'A'
< /code>
< /li>
< /ul>
class A {
public:
static A& GetInstace() { return _singleton; }
private:
inline static A _singleton;
};
int main() {
A& singletonei1 = A::GetInstace();
return 0;
}
Подробнее здесь: https://stackoverflow.com/questions/794 ... tic-member