gdk-graphics 0b051eb9b5c1eaa0658babaa4463dd7a80aa9d2c
Loading...
Searching...
No Matches
jfc::contiguous_view< value_type_param > Class Template Referencefinal

provides an interface to a contiguous sequence of values without exposing the interface of the underlying collection and without copying or moving its data. More...

#include <contiguous_view.h>

Public Types

using size_type = size_t
 
using value_type = value_type_param
 

Public Member Functions

template<class Pointer>
constexpr contiguous_view (Pointer *pBegin, const size_type aSize)
 
template<class Iterator>
constexpr contiguous_view (Iterator iBegin, const size_type aSize)
 
template<class Collection>
constexpr contiguous_view (Collection &aCollection)
 
template<class Pointer>
 contiguous_view (Pointer *pBegin, Pointer *pEnd)
 
template<class Iterator>
 contiguous_view (Iterator aBegin, Iterator aEnd)
 construct from a pair of iterators.
 
constexpr contiguous_view ()=default
 constructs an empty view
 
constexpr contiguous_view (const contiguous_view &)=default
 support copy semantics
 
constexpr contiguous_viewoperator= (const contiguous_view &rhv)=default
 support copy semantics
 
constexpr contiguous_view (contiguous_view &&)=default
 support move semantics
 
constexpr contiguous_viewoperator= (contiguous_view &&rhv)=default
 support move semantics
 
constexpr value_type & operator[] (const size_type index)
 access an element by index
 
constexpr const value_type & operator[] (const size_type index) const
 access an element by index, constant
 
constexpr value_type_param * begin ()
 pointer to the beginning of the data
 
constexpr value_type_param * begin () const
 pointer to the beginning of the data, constant
 
constexpr value_type_param * end ()
 pointer to the element following the last
 
constexpr value_type_param * end () const
 pointer to the element following the last, constant
 
constexpr size_t size () const
 number of elements accessible through the view
 
constexpr bool empty () const
 whether or not size is 0
 

Detailed Description

template<class value_type_param>
class jfc::contiguous_view< value_type_param >

provides an interface to a contiguous sequence of values without exposing the interface of the underlying collection and without copying or moving its data.

  • a view does not own the data it points to.
  • a non-constant view allows the user to read and modify values so long as value_type_param is also a non-constant type.
  • a constant view only allows the user to read values, even if value_type_param is a non-constant type.
  • to construct a view from a constant collection, value_type_param must be const qualified regardless of whether or not the collection's value type is constant since the view will only have access to the collection's constant interface.

Constructor & Destructor Documentation

◆ contiguous_view() [1/4]

template<class value_type_param>
template<class Pointer>
jfc::contiguous_view< value_type_param >::contiguous_view ( Pointer * pBegin,
const size_type aSize )
inlineconstexpr

construct from a pointer to the head of a sequence and the number of values in the sequence

◆ contiguous_view() [2/4]

template<class value_type_param>
template<class Iterator>
jfc::contiguous_view< value_type_param >::contiguous_view ( Iterator iBegin,
const size_type aSize )
inlineconstexpr

construct from an iterator to the beginning of a sequence and the number of values in the sequence

◆ contiguous_view() [3/4]

template<class value_type_param>
template<class Collection>
jfc::contiguous_view< value_type_param >::contiguous_view ( Collection & aCollection)
inlineconstexpr

construct from a STL contiguous collection (array, vector, string) view will encompass the full sequence owned by the collection at the time the view was constructed

◆ contiguous_view() [4/4]

template<class value_type_param>
template<class Pointer>
jfc::contiguous_view< value_type_param >::contiguous_view ( Pointer * pBegin,
Pointer * pEnd )
inline

construct from a pair of pointers.

  • both pointers must point somewhere in the same sequence of data
  • pEnd must come after pBegin in the sequence. pEnd defines the end of the
  • sequence to be viewed, pEnd points to one element after the last

The documentation for this class was generated from the following file: