|
Boost : |
Subject: Re: [boost] [Concepts] Definition. Was [GSoC] [Boost.Hana] Formal review request
From: Marc Glisse (marc.glisse_at_[hidden])
Date: 2014-08-14 02:25:49
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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk