
On Wed, 13 Aug 2014, Robert Ramey wrote:
It's true that compiler support for verification of all the type requirements which someone might come up with falls short of perfection. But as a practical matter, most type requirements are pretty simple and easily supported with current type traits. For example, type requirements for
template<class T> quick_sort(iterator<T> begin, iterator<T> end)
are easily stated AND enforced: BOOST_CONCEPT_REQUIRES((Swappable<T>); BOOST_CONCEPT_REQUIRES((StrictWeakOrdering<T>));
This is useful right now. And few library authors even explicitly state their type requirements - much less include them in code.
This could change in a month - and it will if I have anything to say about it. There is absolutely no advantage to not doing this.
In general, yes, there is an advantage to not doing this: checking the requirements this way triggers some instantiations that you may need to delay. That's the main reason libstdc++ deprecated their concept checks (based on an early version of boost's), they broke too much code that ended up with cycles of A needs B needs C needs A. -- Marc Glisse