Namespaces
Variants
Views
Actions

cpp/named req/AllocatorAwareContainer

From cppreference.com
< cpp‎ | named req
Revision as of 08:10, 1 December 2012 by P12 (Talk | contribs)

Template:cpp/concept/title Template:cpp/concept/navbar

A AllocatorAwareContainer is a Template:concept that has some extra requirements derived from its use of an allocator object.

Requirements

Legend

X Container type
T Element type
A Allocator for T
a, b Objects of type X (non-const lvalue)
t Object of type T (lvalue or const rvalue)
rv Object of type T (non-const rvalue)
m Object of type A
Q Allocator type


expression return type pre/requirements post/effects complexity
allocator_type A allocator_type::value_type must be the same as X::value_type constant
get_allocator() A constant
X u; u.empty() == true && u.get_allocator() == A() constant
X u(m); u.empty() == true && u.get_allocator() == m constant
X u(t,m); u == t && u.get_allocator() == m linear
X u(rv); Move constructor of A must not throw exceptions u has the same elements and an equal allocator as rv had before the construction constant
X u(rv,m); The elements of u are the same or copies of those of rv and u.get_allocator() == m constant if m == rv.get_allocator(), otherwise linear
a = t X& a == t linear
a = rv X& All existing elements of a are either move assigned to or destroyed linear
a.swap(b) void Exchanges the contents of a and b constant

Concept requirements

A
T
X