The move constructor that you have to declare, even though you don't want anyone to actually call it - The Old New Thing

https://devblogs.microsoft.com/oldnewthing/20230612-00/?p=108329

12 points · 4 comments · view on lemmy.world

4 Comments

burrito82@feddit.de · 4 pts · 3y (3 replies)

What can you do? Declare the move constructor, but don’t implement it.

This sounds like a solution that warrants a big huge comment or the next guy to refactor will remove it and break stuff...

caleb-vincent@kbin.social · 4 pts · 3y (1 reply)

That's how we would have to do non-copyable classes before C++11. Older code bases are still filled with unimplemented copy constructors and assignment operators with comments. If you were extra thorough they'd also be private. PC Lint hated both of those tactics.

AlmightySnoo@lemmy.world · 1 pts · 3y

PC Lint

PC-Lint is an abomination that belongs in the depths of hell anyway, it struggles a lot with modern C++/TMP.

gracicot@discuss.tchncs.de · 3 pts · 3y

This is actually what I did. I declared it and left a comment to explain why it needed to be left unimplemented.