Boost logo

Boost :

Subject: Re: [boost] [contract] extra type requirements for contracts
From: Roman Perepelitsa (roman.perepelitsa_at_[hidden])
Date: 2011-09-19 13:58:36


2011/9/19 lcaminiti <lorcaminiti_at_[hidden]>

> CONTRACT_FUNCTION_TPL(
> public void (push_back) ( (const T&) value )
> precondition(
> size() < max_size(),
> )
> postcondition(
> auto old_size = CONTRACT_OLDOF size(),
> auto old_capacity = CONTRACT_OLDOF capacity(),
> back() == value, // (1)
> size() == old_size + 1,
> capacity() >= old_capacity,
> )
> ) ;
> };

Why not use SFINAE expressions to disable post conditions that aren't
well-formed? SFINAE expressions feature is required by the C++11 and is
available in several C++03 implementations including gcc and MSVC.

Roman Perepelitsa.


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