Код: Выделить всё
#include
#include
struct Base
{
};
struct Derived : public Base
{
};
void foo(std::unique_ptr&& b)
{
}
int main()
{
std::unique_ptr derived = std::make_unique();
foo(std::move(derived));
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79391473/validness-of-unique-ptr-passed-as-a-rvalue-reference-to-a-function-inheritance[/url]
Мобильная версия