View Template Library


unique_view<Container, Equal_fn, Const_tag, Iter_tag, Base>

Category: adaptors

Component type: type

Description

The unique_view template is a tranform_view of a equal_range_view presenting the unique values of a container. The properties of any unique_view instance depend on the properties of the container template parameter. The interface of unique_view adapts itself [1] to the referenced container, Container provides a Container interface, a unique_view referencing Forward Containers provides a Forward Container interface while a Random Access Container provides a Random Access Conatiner interface.

The unique_view presents the unique values, depending on the equal_fn template parameter.

The properties of the order of elements are the same as those provided by the underlying container, as is the validity of more than one active iterators at any one time.

A unique_view owns its referenced container, if its base template parameter is aggregated_ownership, it merely references its container, if the base template parameter is referenced_ownership.

Template parameters

Parameter

Description

Default

container

The view's container type: the type of container referenced by this view

equal_fn

The view's comparison function. Compares the contents of two iterators for equality.

std::equal_to<container::value_type>

const_tag

The view's const tag: either const_view_tag or mutable_view_tag

const_view_tag

iterator_tag

The view's directional iterator category

container::iterator::category or bidirectional_iterator_tag whichever is the lesser.

base

The view's ownership type: the base class that determines if the view references or owns the container

referenced_ownership

Definition

Defined in the header unique_view.hpp.

Model of

Single Container View

Type requirements



Members

Member

Where defined

Description

value_type

Container

The type T of the elements accessed through the container.

domain_type

Single View

The type of the referenced container.

pointer

Container

Pointer to T.

reference

Container

Container::reference

const_reference

Container

Contianer::const_reference

size_type

Container

An unsigned integral type.

difference_type

Container

A signed integral type.

iterator

Container

Iterator used to iterate through the view.

const_iterator

Container

Const iterator used to iterate through the view.

reverse_iterator

Reversible Container

Iterator used to iterate backwards through a container.

const_reverse_iterator

Reversible Container

Const iterator used to iterate backwards through a container.

iterator begin()

Container

Returns an iterator pointing to the begin of the view.

iterator end()

Container

Returns an iterator pointing to the end of the view.

const_iterator begin() const

Container

Returns a const_iterator pointing to the begin of the view.

const_iterator end() const

Container

Returns a const_iterator pointing to the end of the view.

reverse_iterator rbegin()

Reversible Container

Valid for reversible container's only. Returns a reverse_iterator pointing to the beginning of the reversed container.

reverse_iterator rend()

Reversible Container

Valid for reversible container's only. Returns a reverse_iterator pointing to the end of the reversed container.

const_reverse_iterator rbegin() const

Reversible Container

Valid for reversible container's only. Returns a const_reverse_iterator pointing to the beginning of the reversed container.

const_reverse_iterator rend() const

Reversible Container

Valid for reversible container's only. Returns a const_reverse_iterator pointing to the end of the reversed container.

size_type size() const

Container

Returns the size of the view.

size_type max_size() const

Container

Returns the largest possible size of the view.

bool empty() const

Container

true if the view's size is 0.

unique_view()

Default Constructible

Creates an empty view.

unique_view(container_t&, const equal_fn_t& = std::equal_to)

view

Creates a view of given container.

void swap(unique_view&)

Container

Swaps the two views. Iterators are invalidated by this operation. For referencing views, the containers themselves are not swapped.

bool operator==(const unique_view&, const unique_view&)

Forward Container

Tests two views for equality. This is a global function, not a member function. Views may be equal even if their referenced containers are not.

bool operator<(const unique_view&, const unique_view&)

Forward Container

Lexicographical comparison. This is a global function, not a member function.

Notes

[1]



VTL Home
Copyright © 1999 Konrad-Zuse-Zentrum für Informationstechnik Berlin & Gary Powell All Rights Reserved.