mirror of
https://github.com/boostorg/contract.git
synced 2026-02-26 16:42:19 +00:00
added .except(...), renamed old_ptr_noncopyable to old_ptr_if_copyable, and renamed OLDOF to OLD
This commit is contained in:
@@ -25,7 +25,7 @@ public:
|
||||
}),
|
||||
data_(new T[capacity]), capacity_(capacity), size_(0)
|
||||
{
|
||||
boost::contract::guard c = boost::contract::constructor(this)
|
||||
boost::contract::check c = boost::contract::constructor(this)
|
||||
.postcondition([&] {
|
||||
BOOST_CONTRACT_ASSERT(empty());
|
||||
BOOST_CONTRACT_ASSERT(full() == (capacity == 0));
|
||||
@@ -36,22 +36,22 @@ public:
|
||||
}
|
||||
|
||||
virtual ~stack() {
|
||||
boost::contract::guard c = boost::contract::destructor(this);
|
||||
boost::contract::check c = boost::contract::destructor(this);
|
||||
delete[] data_;
|
||||
}
|
||||
|
||||
bool empty() const {
|
||||
boost::contract::guard c = boost::contract::public_function(this);
|
||||
boost::contract::check c = boost::contract::public_function(this);
|
||||
return size_ == 0;
|
||||
}
|
||||
|
||||
bool full() const {
|
||||
boost::contract::guard c = boost::contract::public_function(this);
|
||||
boost::contract::check c = boost::contract::public_function(this);
|
||||
return size_ == capacity_;
|
||||
}
|
||||
|
||||
void push(T const& value) {
|
||||
boost::contract::guard c = boost::contract::public_function(this)
|
||||
boost::contract::check c = boost::contract::public_function(this)
|
||||
.precondition([&] {
|
||||
BOOST_CONTRACT_ASSERT(!full());
|
||||
})
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
}
|
||||
|
||||
T pop() {
|
||||
boost::contract::guard c = boost::contract::public_function(this)
|
||||
boost::contract::check c = boost::contract::public_function(this)
|
||||
.precondition([&] {
|
||||
BOOST_CONTRACT_ASSERT(!empty());
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user