
AMDG Robert Jones wrote:
Boost.EnableIf defines enable_if etc, and goes on to define lazy_enable_if, which the documentation states is for the circumstances and compilers when the non-lazy version would break since the instantiation for which SFINAE should apply is a nested instantiation which is not properly processed by some compilers.
What I don't understand is why anyone would wish to use the non-lazy versions, since AFAICS the lazy version will always work.
Then the obvious question is why the non-lazy versions exist at all?
The non-lazy versions exist for ease of use. The lazy versions take a metafunction and are useful when the result is computed. The non-lazy versions are simpler to use when the return type is fixed. For example template<class T> typename boost::enable_if<boost::is_arithmetic<T>, T>::type foo(const T&); There is no point to using the lazy versions. In Christ, Steven Watanabe