Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-06-29 09:41:09


Michael Glassford wrote:
> Doug Gregor wrote:
>
>> Refinements of a concept can only add restrictions,
>> they cannot remove them.
>
> True. But it's not hard to define the concepts in such a way that the
> lock classes can have different constructors:
>
> Lock concept defines all lock operations except constructors.
> TryLock concept refines Lock by adding try_* methods.
> TimedLock concept refines TryLock by adding timed_* methods.
>
> ScopedLock refines Lock by adding appropriate constructors.
> ScopedTryLock refines TryLock by adding appropriate constructors.
> ScopedTimedLock refines TimedLock by adding appropriate constructors.

Yes, it's possible to define them, but it'd be pointless to do so. The idea
of a concept X that refines concept Y is that a generic function can use a X
as if it were an Y. In this case, all refinements are wasted because
construction is a very important property of the concept, since the typical
usage pattern creates scoped locks locally, instead of receiving them
already constructed.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk