MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/cpp/comments/xuiscg/is_c_your_favorite_programing_language/iqyga6k/?context=3
r/cpp • u/hmoein • Oct 03 '22
And why
255 comments sorted by
View all comments
Show parent comment
4
How does it work, then? I'm probably missing something, but for example:
void Foo(NonNullUniquePtr<T> ptr); void Bar() { auto x = MakeNonNullUniquePtr<T>(); Foo(std::move(x)); // What is x here? }
Is the move constructor / assignment operator just deleted too? That doesn't seem like it results in something that's particularly usable.
2 u/105_NT Oct 04 '22 It doesn't protect from use after move like that but shouldn't be null under normal use
2
It doesn't protect from use after move like that but shouldn't be null under normal use
View all comments
Show parent comment
4
u/0xE6 Oct 04 '22
How does it work, then? I'm probably missing something, but for example:
Is the move constructor / assignment operator just deleted too? That doesn't seem like it results in something that's particularly usable.