3 ms·
> The reason STL errors are so convoluted is largely due to the unintuitive and complicated way they use generics to support obscure features like changing the
by naasking 8y ago
> The reason STL errors are so convoluted is largely due to the unintuitive and complicated way they use generics to support obscure features like changing the allocator used by containers.
The reason STL errors are so convoluted is because the C++ template language is Turing complete.
- jcelerier 8y agono, it's because every function is implemented with a dozen helper function so compiler error stack traces have to show all the intermediate, generally return-only, helper functions
- pjmlp 8y agoTrue if we are speaking about C++11 and earlier. With C++14 onwards, it is a matter of developers actually making use of static_assert, constexpr if and enable_if. Not as comfortable as just using concepts, but they get the job done.
- naasking 8y ago> no, it's because every function is implemented with a dozen helper function Which are needed and/or allowed for reuse because the template language is Turing complete. More restrictive type-level languages have better error messages because the compiler either understands what you're intending to do or you're limited in the things you can express, full stop.