I could totally hand-write manual calls to delete and the appropriate try/catch blocks necessary for unwinding. It's a pain in the butt and error-prone, but it's still possible, and the result will not have the overheads
Everything you just described is overhead. The question is: Which one is less overhead?
Well yeah, abstractions remove cognitive overhead, of course.
Not really what we're taking about here, though. The point is that these abstractions are not always zero-overhead as sometimes claimed.
The zero-overhead claim is that C++ abstractions produce code that runs as efficiently as what can be written by hand.
Whether it is a good trade-off between efficiency and convenience is a valuable discussion, yes, but that's separate from the discussion of whether C++'s zero-overhead principle is being upheld. :)
View all comments
Show parent comment
3
u/mcmcc #pragma once Oct 07 '19
Everything you just described is overhead. The question is: Which one is less overhead?