5 ms·
Is there any technical reason why the STL implementation can't include optimized specializations when there are less generic operators it can use?
by rawnlq 11y ago
Is there any technical reason why the STL implementation can't include optimized specializations when there are less generic operators it can use?
- twoodfin 11y agoIt does. That's what std::advance is. For a random access iterator it will use operator+.
- thechao 11y agoNo technical reason; just lack of effort! In fact, a well-optimized implementation of the STL should have a large number of machine-word specific optimizations (a la std::vector<bool>). However, none that I know of, do, other than light unrolling to promote vectorization. About the closest you can find is well-optimized versions of valarray.