Книга: Standard Template Library Programmer
Concepts
Разделы на этой странице:
Generator
Category: functors
Component type: concept
Description
A Generator is a kind of function object: an object that is called as if it were an ordinary C++ function. A Generator is called with no arguments.
Refinement of
Assignable
Associated types
Result type | The type returned when the Generator is called |
Notation
F
A type that is a model of Generator
Result
The result type of F
f
Object of type F
Definitions
The range of a Generator is the set of all possible value that it may return.
Valid expressions
Name | Expression | Return type |
---|---|---|
Function call | f() |
Result |
Expression semantics
Name | Expression | Semantics | Postcondition |
---|---|---|---|
Function call | f() |
Returns some value of type Result [1] | The return value is in f 's range. |
Models
• Result (*)()
Notes
[1] Two different invocations of f may return different results: a Generator may refer to local state, perform I/O, and so on. The expression f() is permitted to change f's state; f might, for example, represent a pseudo-random number generator.
See also
Function Object overview, Unary Function, Binary Function, Adaptable Generator
Похожие страницы
- Basic X Concepts
- Essential DNS Concepts
- Concepts and Properties
- 8.1. Device Driver Concepts
- 9.1. Linux File System Concepts
- 1.3. HARDWARE CONCEPTS
- 1.4. SOFTWARE CONCEPTS
- 12.2 Version Control Concepts
- Concepts and Modeling
- 1.9 POSIX thread concepts
- Real-Time Concepts for Embedded Systems
- 8.5.2 Typical Condition Variable Operations