View Template Library


window_view<container, const_tag, iter_tag, base>

Category: adaptors

Component type: type

Description

The window_view template represents a sliding window over the container. As the window is moved, elements that were hidden become visible. The size of the window remains constant as it is rotated. The interface of window_view adapts itself to the referenced container, if this is one of Container, Forward Container, Reversible Container, Random Access Container, Sequence.

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 window_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


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.

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 window_view.hpp.

Model of

Single Container View

Type requirements



Members

Member

Where defined

Description

value_type

Container

container::value_type

domain_type

Single View

The type of the referenced container.

pointer

Container

contianer::pointer

reference

Container

container::reference

const_reference

Container

container::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.

reference front()

Sequence

Returns a reference for the first element in the window.

reference back()

Sequence

Returns a reference for the last element in the window. Only supported if container is bidirectional.

const_reference front() const

Sequence

Returns a const_reference for the first element in the window.

const_reference back() const

Sequence

Returns a const_reference for the last element in the window. Only supported if container is bidirectional.

void pop_front()

Sequence

Pop one element off the front of the window. The underlying container is not modified.

void pop_back()

Sequence

Pop one element off the back of the window. The underlying container is not modified.

reference operator[](size_type n)

Random access container

Returns a reference for the nth element in the window.

const_reference operator[](size_type n) const

Random access container

Returns a const_reference for the nth element in the window.

reference at(size_type n)

Random access container

Returns a reference for the nth element in the window. 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 windowDoes 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.

void rotate(int n)

window_view

Shift the window n to right if n>0 and left if n <0. The window is shifted over the container.

window_view()

DefaultConstructible

Creates an empty view.

window_view(container_t&, const_domain_iterator & first, const_domain_iterator & last)

window_view

Creates a view of given container. distance(first,last) may not be negative.

window_view(container_t&, const_domain_iterator& first, size_type width)

window_view

Creates a view of given container. The window starts at first and has a size of width. If width is larger than the container's size, the window will cycle around the container several times.

void swap(window_view&)

Container

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

bool operator==(const window_view&, const window_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 window_view&, const window_view&)

Forward Container

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

Notes



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