container_base Interface (original) (raw)

An abstract basic associative container.

Defined in: assoc_container.hpp

Template Parameters

Parameter Description Default Value
typename Key Key type. -
typename Mapped Mapped type. -
class Tag Data structure tag. -
class Policy_Tl Policy typelist. Contains subclasses' policies. -
class Allocator Allocator type. -

Public Types and Constants

General Container Definitions

Type Definition Description
size_type typename Allocator::size_type Size type.
difference_type typename Allocator::difference_type Difference type.

Categories

Type Definition Description
container_category Tag The underlying mapped-structure tag of the container. This is one of: cc_hash_tag gp_hash_tag rb_tree_tag ov_tree_tag splay_tree_tag pat_trie_tag list_update_tag

Policy Definitions

Type Definition Description
allocator Allocator Allocator type.

Key-Type Definitions

Type Definition Description
key_type typename allocator::template rebind< Key>::other::value_type Key type.
key_reference typename allocator::template rebind< key_type>::other::reference Key reference type.
const_key_reference typename allocator::template rebind< key_type>::other::const_reference Const key reference type.
key_pointer typename allocator::template rebind< key_type>::other::pointer Key pointer type.
const_key_pointer typename allocator::template rebind< key_type>::other::const_pointer Const key pointer type.

Mapped-Type Definitions

Type Definition Description
mapped_type Mapped Mapped type.
mapped_reference typename allocator::template rebind< mapped_type>::other::reference Mapped reference type.
const_mapped_reference typename allocator::template rebind< mapped_type>::other::const_reference Const mapped reference type.
mapped_pointer typename allocator::template rebind< mapped_type>::other::pointer Mapped pointer type.
const_mapped_pointer typename allocator::template rebind< mapped_type>::other::const_pointer Const mapped pointer type.

Value-Type Definitions

Type Definition Description
value_type If Mapped is null_mapped_type, then Key Otherwise, Mapped Value type.
reference typename allocator::template rebind< value_type>::other::reference Value reference type.
const_reference typename allocator::template rebind< value_type>::other::const_reference Const value reference type.
pointer typename allocator::template rebind< value_type>::other::pointer Value pointer type.
const_pointer typename allocator::template rebind< value_type>::other::const_pointer Const Value pointer type.

Iterator Definitions

Type Definition Description
const_point_iterator Const point-type iterator. Const point-type iterator.
point_iterator Point-type iterator. If Mapped is null_mapped_type, then this is synonymous to const_point_iterator Point-type iterator.
const_iterator Const range-type iterator. Const range-type iterator.
iterator Range-type iterator. If Mapped is null_mapped_type, then this is synonymous to const_iterator Range-type iterator.

Public Methods

Method Description
virtual ~container_base () Destructor.

Information Methods

Method Description
inline size_type size () const Returns the number of distinct value_type objects the container object is storing.
inline size_type max_size () const Returns an upper bound on the number of distinctvalue_type objects this container can store.
inline bool empty () const Returns whether the container object is not storing any value_type objects.

Insert Methods

Method Description
std::pair<point_iterator, **bool**> insert (const_reference r_val) Inserts a value_type object. If no value_type with r_val's key was in the container object, inserts and returns (point_iterator object associated with r_val, true); otherwise just returns (point_iterator object associated with r_val's key,false).
mapped_reference operator[] (const_key_reference r_key) Subscript operator.

Find Methods

Method Description
point_iterator find (const_key_reference r_key) Returns the point_iterator corresponding to the value_type withr_key as its key, or thepoint_iterator corresponding to the just-after-last entry if no suchvalue_type.
const_point_iterator find (const_key_reference r_key) const Returns the const_point_iterator corresponding to the value_type withr_key as its key, or theconst_point_iterator corresponding to the just-after-last entry if no suchvalue_type.

Erase Methods

Method Description
bool erase (const_key_reference r_key) Erases the value_type associated with r_key. returnsfalse iff r_key was not contained.
template< **class** Pred> size_type erase_if (Pred prd) Erases any value_type satisfying the predicate prd (this is transactional, either all matching value_types are erased, or, if an exception is thrown (for types whose erase can throw an exception) none); returns the number of value_types erased.
void clear () Clears the container object.

Iteration Methods

Method Description
iterator begin () Returns an iterator corresponding to the first value_type in the container.
const_iterator begin () const Returns a const_iterator corresponding to the first value_type in the container.
iterator end () Returns an iterator corresponding to the just-after-last value_type in the container.
const_iterator end () const Returns a const_iterator corresponding to the just-after-last value_type in the container.