вторник, 2 декабря 2014 г.

Ссылки. Концепции в C++

http://ru.cppreference.com/w/cpp/concept

"Эта страница была переведена автоматически с английской версии вики используя Переводчик Google.
Перевод может содержать ошибки и странные формулировки. Наведите курсор на текст, чтобы увидеть оригинал. Вы можете помочь в исправлении ошибок и улучшении перевода. Для инструкций перейдите поссылке.
Щёлкните здесь, чтобы увидеть английскую версию этой страницы"

"
Концепция представляет собой термин, который описывает «именованный набор требований для типа. Понятия более удобный способ указать как, какие свойства ожидать от типа, и какие свойства имеет тип.


Существовал a proposal включить формальной спецификации понятий в C + +11, так что компилятор может проверить тип требований до экземпляра шаблона, и в свою очередь, может производить гораздо более разумным сообщения об ошибке в случае, если тип не выполняют шаблоном требования. Это предложение было сняты по различным причинам. Тем не менее, существуют неофициальные планирует добавить концепции будущего пересмотра языка С + +. 


Здесь' понятия имеют мало общего с вышеупомянутым предложением. Они относятся к неформальным именем требований, используемых в C + +03 и C + +11 для определения поведения и ожидаемых свойств для различных типов. 

"

http://en.cppreference.com/w/cpp/concept

"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 is a proposal to include a formal specification of concepts into a future revision of C++. This proposal allows compilers to check type requirements before template instantiations, allowing much more sensible error messages when those types do not fulfill the template requirements. (This proposal replaces the original C++11 conceptsproposal, which was dropped for various reasons.)
Here concepts have little in common with the abovementioned proposal. They refer to informal named requirements, used in the C++03 and C++11 standards to define behavior and expected properties for various types."

Не удержусь. Процитирую МНОГО:

"

Basic

specifies that an object of the type can be default constructed
(concept)
specifies that an object of the type can be constructed from rvalue
(concept)
specifies that an object of the type can be constructed from lvalue
(concept)
(C++11)
specifies that an object of the type can be assigned from rvalue
(concept)
specifies that an object of the type can be assigned from lvalue
(concept)
specifies that type has a destructor
(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)
(C++11)
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 swapped with an unqualified non-member function call swap()
(concept)
(C++11)
an Iterator that dereferences to a Swappable type
(concept)
(C++11)
pointer-like type supporting a null value
(concept)
(C++11)
FunctionObject that for inputs with different values has a low probability of giving the same output
(concept)
class type that contains allocation information
(concept)
an object that can be called with the function call syntax
(concept)
a type for which the invoke operation is defined
(concept)
FunctionObject that returns a value convertible to bool for one argument without modifying it
(concept)
FunctionObject that returns a value convertible to bool for two arguments without modifying them
(concept)
BinaryPredicate that establishes an ordering relation
(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 default-constructed in uninitialized storage
(concept)
(C++11)
element can be copy-constructed in uninitialized storage
(concept)
(C++11)
element can be move-constructed in uninitialized storage
(concept)
element can be constructed in uninitialized storage
(concept)
(C++11)
element can be destroyed using an allocator
(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)
iterator to contiguously-allocated elements
(concept)

Stream I/O functions

a stream input function that doesn't skip whitespace and counts the processed characters
(concept)
a stream input function that skips leading whitespace
(concept)
a basic stream output function
(concept)
a stream output function that sets failbit on errors and returns a reference to the stream
(concept)

Random Number Generation

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

Concurrency

(C++11)
provides exclusive ownership semantics for execution agents (i.e. threads)
(concept)
(C++11)
adds attempted lock acquisition to BasicLockable
(concept)
(C++11)
adds timed lock acquisition to Lockable
(concept)
(C++11)
Lockable that protects against data races and sequentially consistent synchronization
(concept)
(C++11)
TimedLockable that protects against data races and sequentially consistent synchronization
(concept)
TimedMutex that supports shared ownership mode
(concept)

Other

(C++11)
describes a property of a type
(concept)
(C++11)
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)
(C++11)
Clock 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)
a type for which initialization is effectively equal to assignment
(concept)
(C++11)
defines types and functions used by the regular expressions library
(concept)
(C++11)
a type with constexpr constructor
(concept)
"

-- по-моему - это стоит читать.

Ну и "о своём" - http://programmingmindstream.blogspot.ru/2014/11/property-c.html?showComment=1417552044613#c506596821685402090

Комментариев нет:

Отправить комментарий