This section describes concepts - named sets of requirements placed on
actual types. None of the types or classes decribed in this section are
actual types and none of them can be used by the library's end-user code.
They are here just to describe the requirements that the types conforming
to the individual concepts must satisfy in order to be considered models
of those concepts. The concepts described here are also used are function
parameters or return value types in this reference. In such cases the actual
type is an implementation detail. If values of such types are returned
from a function and need to be stored in variables, then the auto
type specifier (or the decltype
operator) should be
used to determine the concrete type.
Range
is a concept
for classes, which allow simple forward traversal of elements of a specified
type. As with other concepts the Range
templated class
does not actually exist and cannot be used in end-user code. It is used
here to describe the requirements that all actual types conforming to
this concept must satisfy. If this concept is used as a function return
value type, then the actual type must be obtained by using the auto
type specifier or with the decltype
operator.
There is also a whole set of utilities for working with real types conforming to the Range concept.
template <typename Element> class Range { public: typedef const Element ValueType; Range(const Range&); bool Empty(void) const; size_t Size(void) const; void Next(void); ValueType Front(void); };
The type into which the value returned by |
|
Ranges are copyable. |
|
Returns true if the range is empty. |
|
Returns the number of |
|
This function moves the front of the range one element ahead. The
range must not be empty when calling |
|
Returns the elements at the front of the range. The range must not be empty when calling Front, otherwise the result is undefined and the application may be aborted. |
A Metafunction
is a compile-time metaprogramming primitive
that evaluates into a type. Types modelling this
concept must have a member typedef
called Type
- the result of the metafunction. OGLplus end-users rarely need to work
with metafunctions directly, they are used mostly as internal implementation
details.
struct Metafunction { typedef <Unspecified> Type; };