// Test old value error when operations to check them missing (e.g., `==`). #include #include #include #include #include template void push_back(std::vector& vect, T const& val) { boost::contract::guard c = boost::contract::function() .postcondition([&] { BOOST_CONTRACT_ASSERT(vect.back() == val); // Error (j has no ==). }) ; vect.push_back(val); } struct j { // Type without operator==. explicit j(int i) : j_(i) {} private: int j_; }; int main() { std::vector vi; push_back(vi, 123); j jj(456); std::vector vj; push_back(vj, jj); return 0; }