
----- Original Message ----- From: "Douglas Gregor" <doug.gregor@gmail.com>
On Feb 23, 2005, at 10:34 AM, christopher diggins wrote:
<doug.gregor@gmail.com> To: <boost@lists.boost.org>
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