Interface Documentation
Version: invalid
List of all members
flecsi::util::array_ref< T > Class Template Reference

Public Types

types
typedef T value_type
 
typedef const T * pointer
 
typedef const T & reference
 
typedef const T & const_reference
 
typedef const T * const_iterator
 
typedef const_iterator iterator
 
typedef std::reverse_iterator< const_iteratorconst_reverse_iterator
 
typedef const_reverse_iterator reverse_iterator
 
typedef std::size_t size_type
 
typedef ptrdiff_t difference_type
 

Public Member Functions

construct/copy
constexpr array_ref ()
 
constexpr array_ref (const array_ref &)=default
 
array_refoperator= (const array_ref &)=default
 
constexpr array_ref (const T *array, const size_type length)
 
template<typename Allocator >
 array_ref (const std::vector< T, Allocator > &v)
 
template<typename traits , typename Allocator >
 array_ref (const std::basic_string< T, traits, Allocator > &s)
 
template<size_type N>
constexpr array_ref (const T(&a)[N])
 
template<size_type N>
constexpr array_ref (const std::array< T, N > &a)
 
constexpr array_ref substr (const size_type pos, const size_type n=size_type(-1)) const
 
iterators
constexpr const_iterator begin () const
 
constexpr const_iterator end () const
 
constexpr const_iterator cbegin () const
 
constexpr const_iterator cend () const
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator crend () const
 
capacity
constexpr size_type size () const
 
constexpr size_type max_size () const
 
constexpr bool empty () const
 
element access
constexpr const T & operator[] (const size_type i) const
 
constexpr const T & at (const size_type i) const
 
constexpr const T & front () const
 
constexpr const T & back () const
 
constexpr const T * data () const
 
Outgoing conversion operators

These functions provide explicit conversions to selected other contiguous sequence types using those types' iterator-range constructors. We provide both explicit conversion operators for use in variable initialization and short member functions for use in function calls.

The operators are explicit to avoid accidental O(N) operations on type mismatches.

 operator std::vector< T > () const
 
std::vector< T > vec () const
 
template<typename traits , typename Allocator >
 operator std::basic_string< T, traits, Allocator > () const
 
std::basic_string< T > str () const
 
mutators
void clear ()
 
void remove_prefix (const size_type n)
 
void remove_suffix (const size_type n)
 
void pop_back ()
 
void pop_front ()
 

Member Typedef Documentation

◆ const_iterator

template<typename T >
typedef const T* flecsi::util::array_ref< T >::const_iterator
random-access, contiguous iterator type

◆ iterator

template<typename T >
typedef const_iterator flecsi::util::array_ref< T >::iterator

Because array_ref controls a constant sequence, iterator and const_iterator are the same type.

◆ pointer

template<typename T >
typedef const T* flecsi::util::array_ref< T >::pointer
Todo:
Should the pointer type be configurable as a template argument?

Constructor & Destructor Documentation

◆ array_ref() [1/3]

template<typename T >
constexpr flecsi::util::array_ref< T >::array_ref ( )
inline
Postcondition
empty() == true

◆ array_ref() [2/3]

template<typename T >
template<typename Allocator >
flecsi::util::array_ref< T >::array_ref ( const std::vector< T, Allocator > &  v)
inline
Todo:
Arguably, this conversion should be a std::vector conversion operator.

◆ array_ref() [3/3]

template<typename T >
template<size_type N>
constexpr flecsi::util::array_ref< T >::array_ref ( const std::array< T, N > &  a)
inline
Todo:
Arguably, this conversion should be a std::array conversion operator.

Member Function Documentation

◆ clear()

template<typename T >
void flecsi::util::array_ref< T >::clear ( )
inline
Effects:
Resets *this to its default-constructed state.

◆ data()

template<typename T >
constexpr const T* flecsi::util::array_ref< T >::data ( ) const
inline
Returns
A pointer such that [data(),data() + size()) is a valid range. For a non-empty array_ref, data() == &front().

◆ operator std::basic_string< T, traits, Allocator >()

template<typename T >
template<typename traits , typename Allocator >
flecsi::util::array_ref< T >::operator std::basic_string< T, traits, Allocator > ( ) const
inlineexplicit
Todo:
Arguably, this conversion should be a std::basic_string constructor.

◆ operator std::vector< T >()

template<typename T >
flecsi::util::array_ref< T >::operator std::vector< T > ( ) const
inlineexplicit
Todo:
Arguably, this conversion should be a std::vector constructor.

◆ pop_back()

template<typename T >
void flecsi::util::array_ref< T >::pop_back ( )
inline
Effects:
remove_suffix(1)

◆ pop_front()

template<typename T >
void flecsi::util::array_ref< T >::pop_front ( )
inline
Effects:
remove_prefix(1)

◆ remove_prefix()

template<typename T >
void flecsi::util::array_ref< T >::remove_prefix ( const size_type  n)
inline
Effects:
Advances the start pointer of this array_ref past n elements without moving the end pointer.

◆ remove_suffix()

template<typename T >
void flecsi::util::array_ref< T >::remove_suffix ( const size_type  n)
inline
Effects:
Moves the end pointer of this array_ref earlier by n elements without moving the start pointer.

◆ substr()

template<typename T >
constexpr array_ref flecsi::util::array_ref< T >::substr ( const size_type  pos,
const size_type  n = size_type(-1) 
) const
inline
Todo:
See basic_string_ref::substr for interface questions. We want something like this on array_ref, but probably not with this name.

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