2 // Copyright (C) 2008-2018 Lorenzo Caminiti
3 // Distributed under the Boost Software License, Version 1.0 (see accompanying
4 // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
5 // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html
7 // Test assertion error when operations to check them missing (e.g., `==`).
9 #include <boost/contract/function.hpp>
10 #include <boost/contract/check.hpp>
11 #include <boost/contract/assert.hpp>
15 void push_back(std::vector<T>& vect, T const& value) {
16 boost::contract::check c = boost::contract::function()
18 BOOST_CONTRACT_ASSERT(vect.back() == value); // Error (j has no ==).
19 #ifdef BOOST_CONTRACT_NO_ALL
20 #error "force error if no contracts (ASSERT expands to nothing)"
24 vect.push_back(value);
27 struct j { // Type without operator==.
28 explicit j(int /* i */) {}