
16 Jul
2015
16 Jul
'15
11:12 a.m.
Mathias Gaunard wrote:
A core foundational library should not instantiate templates that it doesn't strictly need to. Instantiating templates has a very high impact on compile-time memory usage, performance, ...
That's not always true in C++11/17. One example is the and<T...> primitive, for which the short-circuit version is much slower than the one that always expands T::value... . Another is find_if<L<T...>, P>, which is also much faster when it expands P<T>... for every element, even though it technically doesn't need to proceed beyond the first element for which P<T> is true.
and on the well-formed programs it allows.