[Concept Name]


Description

[A description of the concept's purpose. For purposes of illustration, the following is filled with the information for the Container concept from the STL Library.]

Refinement of

[A list of other concepts that this concept refines, with links to those concepts.]

Assignable

Definitions

[Some concepts, such as LessThan Comparable, use specialized terminology. If a concept requires any such terminology, it is defined in this section. example:]

The size of a container is the number of elements it contains. The size is a nonnegative number.

Notation

[The next two sections, associated types and valid expressions, present expressions involving types that model the concept being defined. This section defines the meaning of the variables and identifiers used in those expressions.]

XA type that is a model of the [Concept Name]
x, a, bAn object of type X
... 

Associated Types

[A concept is a set of requirements on some type. Frequently, however, some of those requirements involve some other type. For example, one of the Unary Function requirements is that a Unary Function must have an argument type; if F is a type that models Unary Function and f is an object of type F, then, in the expression f(x), x must be of F's argument type. If a concept does not have any such associated types this section can be eliminated.]

X::value_typeA type of an object stored in [Concept Name]
X::iteratorAn object of type X
... 

Valid Expressions

[A type that models a concept is required to support certain operations. In most cases, it doesn't make sense to describe this in terms of specific functions or member functions. For example, it doesn't make any difference whether a type that models Input Iterator uses a global function or a member function to provide operator++. This section lists the expressions that a type modeling this concept must support. It includes any special requirements (if any) on the types of the expression's operands, and the expression's return. Example: ]

In addition to the expressions defined in Assignable the following expressions must be valid.

ParameterType RequirementsDescription
x.begin()None, except for those imposed by the requirements of Random Access Container and Back Insertion Sequence.

The value type. This is also defined as vector:::value_type

x.size()Alloc is an Allocator.The types allocator, used for all internal memory management.
...(only needed for templates) 

Complexity Guarentees

[In some cases, the run-time complexity of certain operations is an important part of a concept's requirements. For example, one of the most significant distinctions between a Bidirectional Iterator and a Random Access Iterator is that, for random access iterators, expressions like p + n take constant time. Any such requirements on run-time complexity are listed in this section. If there are no such requirements, this section can be eliminated.]

Invariants

[Many concepts require that some property is always true for objects of a type that models the concept being defined. For example, LessThan Comparable imposes the requirement of transitivity: if x < y and y < z, then x < z. Some such properties are "axioms" (that is, they are independent of any other requirements) and some are "theorems" (that is, they follow either from requirements in the expression semantics section or from other requirements in the invariants section). This section can be eliminated If there are no invariants.]

For any container a, [a.begin(), a.end()) is a valid range.
a.size() is equal to the distance from a.begin() to a.end()
...

Header

[A link to the source code where the concept checking header is defined. This header should contain boost concept checking class for this concept]

#include <boost/concept_check.hpp>

Models

[A list of examples of types that are models of this concept. Note that this list is not intended to be complete: in most cases a complete list would be impossible, because there are an infinite number of types that could model the concept. Example:]

std::vector<T>

Notes

[Footnotes that are referred to by other parts of the page. If there are notes on the page, this section can be eliminated][1]

See Also

[links to other related concepts]

Iterator Overview, input Iterator

There are 0 comments and replies

Comment on This Page