3 ms·
"Easy to copy" means it makes sense to copy as needed in a given context. Large vectors of strings adhere to the CopyConstructible concept, but we don't general
by humanrebar 10y ago
"Easy to copy" means it makes sense to copy as needed in a given context. Large vectors of strings adhere to the CopyConstructible concept, but we don't generally recommend copying those around.
Which brings up a good point. The concepts proposal exists because there are implicit (though hopefully documented) contracts that are either unenforced or enforced in arcane ways (large amounts of error spew obscuring fairly simple violations, such as a missing copy constructor).
Anyway, I was trying to point out that there are many language-legal designs we can conceive that force design decisions and other entanglements on other pieces of code. It just so happens that C++ has much more flexibility than many languages, so it gives new opportunities to make those mistakes. I was pointing out that otherwise helpful authors aren't aware of the extra pitfalls, so they tend not to point them out very clearly.
As a result, for example, we see a lot of Java-like C++ that basically assumes the rest of the code can and should be structured similarly. Even something as seemingly innocuous as using shared_ptr as a method parameter can cause unintended issues in other code.