diff --git a/Buffer.html b/Buffer.html new file mode 100644 index 0000000..f869afc --- /dev/null +++ b/Buffer.html @@ -0,0 +1,85 @@ + + + +
+A Buffer is something in which items can be put and removed. The Buffer concept has very few requirements. It does not require any particular ordering of how the items are stored or in what order they will appear when removed, however, there is typically some sort of ordering policy.
+ +For a type to model the Buffer concept it must have the following members.
+ +Member | +Description | +
---|---|
value_type | +The type of object stored in the Buffer. The value type must be Assignable. | +
size_type | +An unsigned integral type for representing the number of objects in the Buffer. | +
void push(const T& t) | +Inserts t into the Buffer. size() will be incremented by one. | +
void pop() | +Removes an object from the Buffer. size() will be decremented by one. Precondition: empty() is false. | +
T& top() | +Returns a mutable reference to some object in the Buffer. Precondition: empty() is false. | +
const T& top() const | +Returns a const reference to some object in the Buffer. Precondition: empty() is false. | +
void size() const | +Returns the number of objects in the Buffer. Invariant: size() >= 0. | +
bool empty() const | +Equivalent to b.size() == 0. | +
Copyright © 2004 | +Jeremy Siek, Univ. of Notre Dame (jsiek@lsc.nd.edu) | +
Use, modification, and distribution are subject to the Boost Software License, Version 1.0 at http://www.boost.org/LICENSE_1_0.txt
+ + + diff --git a/UpdatableBuffer.html b/UpdatableBuffer.html new file mode 100644 index 0000000..99c8779 --- /dev/null +++ b/UpdatableBuffer.html @@ -0,0 +1,96 @@ + + + + +An UpdatableBuffer is a special type of Buffer that provides an update operation for when the Buffer's ordering policy changes.
+ +For a type to model the UpdatableBuffer concept it must have the following members.
+ +Member | +Where Defined | +Description | +
---|---|---|
value_type | +Buffer | +The type of object stored in the Buffer. The value type must be Assignable. | +
size_type | +Buffer | +An unsigned integral type for representing the number of objects in the Buffer. | +
void update(const T& t) | +UpdatableBuffer | +Revalidates this Updatable Buffer. An Updatable Buffer is invalidated if its ordering policy changes with respect to t but its internal structure does not reflect that change. Precondition: t is in the buffer. |
+
void push(const T& t) | +Buffer | +Inserts t into the Buffer. size() will be incremented by one. | +
void pop() | +Buffer | +Removes an object from the Buffer. size() will be decremented by one. Precondition: empty() is false. |
+
T& top() | +Buffer | +Returns a mutable reference to some object in the Buffer. Precondition: empty() is false. | +
const T& top() const | +Buffer | +Returns a const reference to some object in the Buffer. Precondition: empty() is false. | +
void size() const | +Buffer | +Returns the number of objects in the Buffer. Invariant: size() >= 0. | +
bool empty() const | +Buffer | +Equivalent to b.size() == 0. | +
Copyright © 2004 | +Jeremy Siek, Univ. of Notre Dame (jsiek@lsc.nd.edu) | +
Use, modification, and distribution are subject to the Boost Software License, Version 1.0 at http://www.boost.org/LICENSE_1_0.txt
+ + + diff --git a/queue.html b/queue.html new file mode 100644 index 0000000..9803b6c --- /dev/null +++ b/queue.html @@ -0,0 +1,180 @@ + + + + +A boost::queue is a container adaptor that provides both std::queue and Buffer functionality.
+ +Parameter | +Description | +Default | +
---|---|---|
T | +The type of object stored in the queue. | ++ |
Sequence | +The type of the underlying container used to implement the queue. | +std::deque<T> | +
None.
+ +Member | +Where Defined | +Description | +
---|---|---|
value_type | +Buffer | +The type of object stored in the queue. This is the same as T and Sequence::value_type. | +
size_type | +Buffer | +An unsigned integral type. This is the same as Sequence::size_type. | +
queue() | +Default Constructible | +The default constructor. Creates an empty queue. | +
queue(const Sequence& c) | +boost::queue | +The constructor. Creates a queue initialized to contain the elements in c, in back-insertion order. | +
bool empty() const | +Buffer | +Returns true if the queue contains no elements, and false otherwise. empty() is equivalent to size() == 0. | +
size_type size() const | +Buffer | +Returns the number of elements contained in the queue. | +
value_type& top() | +Buffer | +Returns a mutable reference to the least recently inserted element in the queue. Precondition: empty() is false. | +
value_type& front() | +std::queue | +Serves the same function as value_type& top(). | +
const value_type& top() const | +Buffer | +Returns a const reference to the least recently inserted element in the queue. Precondition: empty() is false. | +
const value_type& front() const | +boost::queue, not std::queue | +Serves the same function as const value_type& top() const. | +
void push(const value_type& x) | +Buffer | +Inserts x into the queue. Postcondition: size() will be incremented by 1. | +
void pop() | +Buffer | +Removes the least recently inserted element from the queue. Postcondition: size() will be decremented by 1. | +
bool operator==(const queue&, const queue&) | +boost::queue | +Compares two queues for equality. Two queues are equal if they contain the same number of elements and if they are equal element-by-element. This is a global function, not a member function. | +
bool operator<(const queue&, const queue&) | +boost::queue | +Lexicographical ordering of two queues. This is a global function, not a member function. | +
#include <boost/queue> +#include <cassert> + +int main() +{ + boost::queue<int> Q; + + Q.push(8); + Q.push(7); + Q.push(6); + Q.push(2); + + assert(Q.size() == 4); + assert(Q.top() == 8); + Q.pop(); + + assert(Q.top() == 7); + Q.pop(); + + assert(Q.top() == 6); + Q.pop(); + + assert(Q.top() == 2); + Q.pop(); + + assert(Q.empty()); + + return 0; +} ++ +
Copyright © 2004 | +Jeremy Siek, Univ. of Notre Dame (jsiek@lsc.nd.edu) | +
Use, modification, and distribution are subject to the Boost Software License, Version 1.0 at http://www.boost.org/LICENSE_1_0.txt
+ + +