|
Boost : |
From: christopher diggins (cdiggins_at_[hidden])
Date: 2005-02-23 19:46:26
----- Original Message -----
From: "Douglas Gregor" <doug.gregor_at_[hidden]>
> On Feb 23, 2005, at 10:34 AM, christopher diggins wrote:
>> <doug.gregor_at_[hidden]>
>> To: <boost_at_[hidden]>
>
>> 1) The proposed PwC approach would provide consistent behaviour across
>> STL implementations.
>
> Isn't that more a property of the adaptor approach than PwC? You can pass
> any container to the adaptor, regardless of the underlying library, and it
> will perform the checks when it interfaces with that container.
My turn to be confused. What difference does it make whether we call the
approach an adapator or PwC?
>> template<Vector_T>
>> void MyAlgorithm(Vector_T& x) {
>> #ifdef DEBUG
>> BOOST_STATIC_ASSERT(vector_contract_concept<Vector_T>::satisfied)
>> #endif
>> // do stuff
>> }
>
> I don't understand this part... it looks like a concept check (i.e.,
> syntax), but above it sounds like you're saying that this verifies the
> contract (i.e., semantics). How can we check the semantics with a static
> assert?
We can check that the passed type is wrapped in the appropriate contract
class. This is not a general solution, but it is one possible application of
contracts.
CD
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk