Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/named req"

From cppreference.com
< cpp
(added summaries for BasicLockable and Lockable)
(+descs)
Line 58: Line 58:
  
 
{{dcl list h1 | Random Number Generation}}
 
{{dcl list h1 | Random Number Generation}}
{{dcl list concept | cpp/concept/SeedSequence | notes={{mark c++11}} }}
+
{{dcl list concept | cpp/concept/SeedSequence | consumes a sequence of integers and produces a sequence of 32-bit unsigned values | notes={{mark c++11}} }}
{{dcl list concept | cpp/concept/UniformRandomNumberGenerator | notes={{mark c++11}} }}
+
{{dcl list concept | cpp/concept/UniformRandomNumberGenerator | returns uniformly distributed random unsigned integers | notes={{mark c++11}} }}
{{dcl list concept | cpp/concept/RandomNumberEngine | notes={{mark c++11}} }}
+
{{dcl list concept | cpp/concept/RandomNumberEngine | a deterministic {{concept|UniformRandomNumberGenerator}}, defined by the seed | notes={{mark c++11}} }}
{{dcl list concept | cpp/concept/RandomNumberEngineAdaptor | notes={{mark c++11}} }}
+
{{dcl list concept | cpp/concept/RandomNumberEngineAdaptor | a {{concept|RandomNumberEngine}} that transforms the output of another {{concept|RandomNumberEngine}} | notes={{mark c++11}} }}
{{dcl list concept | cpp/concept/RandomNumberDistribution | notes={{mark c++11}} }}
+
{{dcl list concept | cpp/concept/RandomNumberDistribution | returns random numbers distributed according to a given mathematical probability density function | notes={{mark c++11}} }}
  
 
{{dcl list h1 | Concurrency}}
 
{{dcl list h1 | Concurrency}}
 
{{dcl list concept | cpp/concept/BasicLockable | provides exclusive ownership semantics for execution agents (i.e. threads) | notes={{mark c++11}} }}
 
{{dcl list concept | cpp/concept/BasicLockable | provides exclusive ownership semantics for execution agents (i.e. threads) | notes={{mark c++11}} }}
 
{{dcl list concept | cpp/concept/Lockable | adds attempted lock acquisition to {{concept|BasicLockable}} | notes={{mark c++11}} }}
 
{{dcl list concept | cpp/concept/Lockable | adds attempted lock acquisition to {{concept|BasicLockable}} | notes={{mark c++11}} }}
{{dcl list concept | cpp/concept/TimedLockable | notes={{mark c++11}} }}
+
{{dcl list concept | cpp/concept/TimedLockable | adds timed lock acquisition to {{concept|Lockable}} | notes={{mark c++11}} }}
{{dcl list concept | cpp/concept/Mutex | notes={{mark c++11}} }}
+
{{dcl list concept | cpp/concept/Mutex | a {{concept|Lockable}} that protects against data races and sequentially consistent synchronization | notes={{mark c++11}} }}
{{dcl list concept | cpp/concept/TimedMutex | notes={{mark c++11}} }}
+
{{dcl list concept | cpp/concept/TimedMutex | a {{concept|TimedLockable}} that protects against data races and sequentially consistent synchronization | notes={{mark c++11}} }}
  
 
{{dcl list h1 | Other}}
 
{{dcl list h1 | Other}}
{{dcl list concept | cpp/concept/UnaryTypeTrait | notes={{mark c++11}} }}
+
{{dcl list concept | cpp/concept/UnaryTypeTrait | describes a property of a type | notes={{mark c++11}} }}
{{dcl list concept | cpp/concept/BinaryTypeTrait | notes={{mark c++11}} }}
+
{{dcl list concept | cpp/concept/BinaryTypeTrait | describes a relationship  between two types |  notes={{mark c++11}} }}
{{dcl list concept | cpp/concept/TransformationTrait | notes={{mark c++11}} }}
+
{{dcl list concept | cpp/concept/TransformationTrait | modifies a property of a type | notes={{mark c++11}} }}
{{dcl list concept | cpp/concept/Clock | notes={{mark c++11}} }}
+
{{dcl list concept | cpp/concept/Clock | aggregates a duration, a time point, and a function to get the current time point | notes={{mark c++11}} }}
{{dcl list concept | cpp/concept/TrivialClock | notes={{mark c++11}} }}
+
{{dcl list concept | cpp/concept/TrivialClock | a {{concept|Clock}} that doesn't throw exceptions | notes={{mark c++11}} }}
{{dcl list concept | cpp/concept/CharTraits}}
+
{{dcl list concept | cpp/concept/CharTraits | defines types and functions for a character type}}
{{dcl list concept | cpp/concept/pos_type}}
+
{{dcl list concept | cpp/concept/pos_type | represents a position in a stream }}
{{dcl list concept | cpp/concept/off_type}}
+
{{dcl list concept | cpp/concept/off_type | represents an offset in a stream }}
{{dcl list concept | cpp/concept/BitmaskType}} <!-- $17.5.2.1.3[bitmask types] -->
+
{{dcl list concept | cpp/concept/BitmaskType | bitset, integer, or enumeration}} <!-- $17.5.2.1.3[bitmask types] -->
  
 
{{dcl list end}}
 
{{dcl list end}}

Revision as of 06:18, 24 July 2012

Template:cpp/concept/navbar

A concept is a term that describes a named set of requirements for a type. Concepts are a more convenient way to specify both what properties are expected from a type, and what properties a type has.

There was a proposal to include a formal specification of concepts into C++11 so that the compiler could check the type requirements before template instantiation and in turn could produce much more sensible error messages in case a type did not fulfill the template requirements. This proposal was later dropped for various reasons. However, there are unofficial plans to add concepts to a future revision of the C++ language.

Here concepts have little in common with the abovementioned proposal. They refer to informal named requirements, used in C++03 and C++11 to define behavior and expected properties for various types.

Contents

Basic

specifies that type has default constructor
(concept)
specifies that type has move constructor
(concept)
specifies that type has copy constructor
(concept)
specifies that type can move assignment operator
(concept)
specifies that type has copy assignment operator
(concept)
type has a destructor that clears all memory
(concept)

Layout

Note, that the standard doesn't define named requirements or concepts with names specified in this subcategory.
These are type categories defined by the core language. They are included here as concepts only for consistency.
class with trivial copy, assignment and destructor
(concept)
class with trivial constructors, assignment and destructor
(concept)
non-virtual class containing only other StandardLayout members, all with the same access control
(concept)
POD (Plain Old Data) structure, compatible with C struct
(concept)

Library-wide

has a working operator== that is an equivalence relation
(concept)
operator< is a strict weak ordering relation
(concept)
(C++11)
can be used as argument of std::swap
(concept)
pointer-like type that when dereferenced can be passed to std::swap
(concept)
pointer-like type supporting a null value
(concept)
(C++11)

(concept)
class type that contains allocation information
(concept)
a function object that can be called with specific arguments and has return value convertible to specific type
(concept)
a Template:concept that returns a value convertible to bool for one argument without modifying it
(concept)
a Template:concept that returns a value convertible to bool for two arguments without modifying them
(concept)

Container

data structure that allows element access using iterators
(concept)
container using bidirectional iterators
(concept)
container using an allocator
(concept)
container with elements stored linearly
(concept)
container that stores elements by associating them to keys
(concept)
container that stores elements stored in buckets by associating them to keys
(concept)
Container element
element can be copy-constructed in uninitialized storage
(concept)
element can be move-constructed in uninitialized storage
(concept)
element can be constructed in uninitialized storage
(concept)

Iterator

general concept to access data within some data structure
(concept)
iterator that can be used to read data
(concept)
iterator that can be used to write data
(concept)
iterator that can be used to read data multiple times
(concept)
iterator that can be both incremented and decremented
(concept)
iterator that can be advanced in constant time
(concept)

Random Number Generation

consumes a sequence of integers and produces a sequence of 32-bit unsigned values
(concept)
returns uniformly distributed random unsigned integers
(concept)
a deterministic Template:concept, defined by the seed
(concept)
a Template:concept that transforms the output of another Template:concept
(concept)
returns random numbers distributed according to a given mathematical probability density function
(concept)

Concurrency

provides exclusive ownership semantics for execution agents (i.e. threads)
(concept)
(C++11)
adds attempted lock acquisition to Template:concept
(concept)
adds timed lock acquisition to Template:concept
(concept)
(C++11)
a Template:concept that protects against data races and sequentially consistent synchronization
(concept)
a Template:concept that protects against data races and sequentially consistent synchronization
(concept)

Other

describes a property of a type
(concept)
describes a relationship between two types
(concept)
modifies a property of a type
(concept)
(C++11)
aggregates a duration, a time point, and a function to get the current time point
(concept)
a Template:concept that doesn't throw exceptions
(concept)
defines types and functions for a character type
(concept)
represents a position in a stream
(concept)
represents an offset in a stream
(concept)
bitset, integer, or enumeration
(concept)