View Template Library


range_view<Iterator, Const_Iterator>

Category: adaptors

Component type: type

Description

The range_view template represents objects that reference a range [first,last), and that have methods for accessing its elements. The properties of any range_view instance depend on the properties of the iterator template parameter. The interface of range_view adapts itself to the referenced range, as this is given by forward, bidirectional or random access iterators.

The range_view presents a range of values. The range's elements themselves are not altered.

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

Template parameters

Parameter

Description

Default

iterator

The view's iterator type


const_iterator

The view's const_iterator type.

iterator

Definition

Defined in the header range_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 iterator.

pointer

Container

iterator::pointer

reference

Container

iterator::reference

const_reference

Container

const_iterator::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 range.

const_reverse_iterator

Reversible Container

Const iterator used to iterate backwards through a range.

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 bidirectional iterator's only. Returns a reverse_iterator pointing to the beginning of the reversed range.

reverse_iterator rend()

Reversible Container

Valid for bidirectional iterator's only. Returns a reverse_iterator pointing to the end of the reversed range.

const_reverse_iterator rbegin() const

Reversible Container

Valid for bidirectional iterator's only. Returns a const_reverse_iterator pointing to the beginning of the reversed range.

const_reverse_iterator rend() const

Reversible Container

Valid for bidirectional iterator's only. Returns a const_reverse_iterator pointing to the end of the reversed range.

reference front()

Sequence

Returns a reference for the first element in the range.

reference back()

Sequence

Returns a reference for the last element in the range. Valid for bidirectional iterator's only.

const_reference front() const

Sequence

Returns a const_reference for the first element in the range.

const_reference back() const

Sequence

Returns a const_>reference for the last element in the range. Valid for bidirectional iterator's only.

void pop_front()

Sequence

Increment the beginning iterator. Does not modify the underlying range.

void pop_back()

Sequence

Decrement the ending iterator. Does not modify the underlying range.

reference operator[](size_type n)

Random access container

Returns a reference for the nth element in the range. Only supported if iterator is random access.

const_reference operator[](size_type n) const

Random access container

Returns a const_reference for the nth element in the range. Only supported if iterator is random access.

reference at(size_type n)

Random access container

Returns a reference for the nth element in the range. Only supported if iterator is random access. Does a range check on n and will throw std::range_error if it fails.

const_reference at(size_type n) const

Random access container

Returns a const_reference for the nth element in the range. Only supported if iterator is random access. Does a range check on n and will throw std::range_error if it fails.

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.

range_view()

Default Constructible

Creates an empty view.

range_view(const iterator &, const iterator &)

Range View

Creates a view of given range.

range_view(std::pair<iterator, iterator> const&)

Range View

Creates a view of given range.

void swap(range_view &)

Container

Swaps the two views. Iterators are invalidated by this operation.

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

Forward Container

Tests two views for equality. This is a global function, not a member function.

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

Forward Container

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

Notes



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