Hacker News new | ask | show | jobs
by klodolph 2378 days ago
If you just want a unique_ptr, then you should at least write the code to delete the relevant operators or make them private. Boilerplate, yes, but that is how idiomatic C++ code is written.
1 comments

I'm not sure what you mean. If you have code like this

    struct Foo {
        unique_ptr p;
    };
Foo is automatically not copyable. That code is about is perfectly good idiomatic C++, with zero boilerplate. And that is how most classes actually end up looking in idiomatic C++, there's almost never the need to implement operators.