Код: Выделить всё
#include
template
class MyVector
{
public:
static_assert(std::is_move_constructible_v);
void emplace_back(element_t element) {}
};
class MyClass
{
friend class MyClassMngr;
friend class MyVector;
struct ConstructionKey {};
MyClass(ConstructionKey) {}
public:
MyClass(const MyClass&) = delete;
private:
MyClass(MyClass&&) = default;
};
class MyClassMngr
{
static inline MyVector my_classes;
};
Пример ошибки (gcc):
Код: Выделить всё
:8:19: error: static assertion failed due to requirement 'std::is_move_constructible_v'
8 | static_assert(std::is_move_constructible_v);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:37:37: note: in instantiation of template class 'MyVector' requested here
37 | static inline MyVector my_classes;
|
Подробнее здесь: https://stackoverflow.com/questions/797 ... onstructor