Вот класс:
Код: Выделить всё
class Entity {
public:
//...
Entity() = delete;
Entity(const Entity& entity) = delete;
explicit Entity(Mesh&& mesh) : mesh(std::move(mesh)) {
printf("Entity Created");
}
Entity(Entity&& entity) noexcept: mesh(std::move(entity.mesh)) {
printf("Inside the Entity move Constructor");
}
//...
private:
Mesh mesh;
};
< /code>
А вот как я пытаюсь использовать его :: < /p>
//...
Entity e1(std::move(mesh_1));
Entity e2(std::move(mesh_2));
std::vector entities = {std::move(e1), std::move(e2)};
//...
< /code>
Эта строка вызывает следующую ошибку: < /p>
error: static assertion failed: result type must be constructible from input type
Подробнее здесь: https://stackoverflow.com/questions/796 ... -type-when
Мобильная версия