Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
arene::base::testing::rvalue_iterator< T > Class Template Reference

An iterator whose i'th position yields an rvalue reference to test_value(i) of the given type. More...

Inheritance diagram for arene::base::testing::rvalue_iterator< T >:
Inheritance graph

Public Types

using difference_type = std::make_signed_t<std::size_t>
 The difference type of the iterator; test_value takes std::size_t so the difference is that but signed.
 
using iterator_category = std::random_access_iterator_tag
 The iterator category; random access because we just store an index and yield from it.
 
using pointer = T*
 The pointer type of the iterator; basically not meaningful, and it would be ill-formed to use it.
 
using reference = T&&
 The reference type of the iterator; a value of the expected type, since there's nothing to rvalue-refer to.
 
using value_type = T
 The value type of the iterator; this is the type whose test values are being retrieved.
 

Public Member Functions

constexpr rvalue_iterator (difference_type index=0) noexcept(test_value_is_noexcept)
 Construct an rvalue_iterator containing the test value with the given index (defaulting to 0)
 
constexpr rvalue_iterator (rvalue_iterator &&other) noexcept(std::is_nothrow_move_constructible< T >::value)
 Move construct an rvalue_iterator.
 
constexpr rvalue_iterator (rvalue_iterator const &other) noexcept(test_value_is_noexcept)
 Copy construct an rvalue_iterator, retrieving a new test value so that the value type can be move-only.
 
 ~rvalue_iterator ()=default
 Destroy an rvalue_iterator.
 
constexpr auto operator* () noexcept -> reference
 Dereference an rvalue_iterator; data may no longer be meaningful after the first use.
 
constexpr auto operator+= (difference_type diff) noexcept(test_value_is_noexcept) -> rvalue_iterator &
 Shift an rvalue_iterator by the given amount.
 
constexpr auto operator= (rvalue_iterator &&other) noexcept(std::is_nothrow_move_assignable< T >::value) -> rvalue_iterator &
 Move assign an rvalue_iterator.
 
constexpr auto operator= (rvalue_iterator const &other) noexcept(test_value_is_noexcept) -> rvalue_iterator &
 Copy assign an rvalue_iterator, retrieving a new test value so that the value type can be move-only.
 

Friends

constexpr auto operator- (rvalue_iterator const &left, rvalue_iterator const &right) noexcept -> difference_type
 Get the difference between two rvalue_iterators.
 

Detailed Description

template<typename T>
class arene::base::testing::rvalue_iterator< T >

An iterator whose i'th position yields an rvalue reference to test_value(i) of the given type.

Template Parameters
TThe type to yield

Member Typedef Documentation

◆ difference_type

template<typename T>
using arene::base::testing::rvalue_iterator< T >::difference_type = std::make_signed_t<std::size_t>

The difference type of the iterator; test_value takes std::size_t so the difference is that but signed.

◆ iterator_category

template<typename T>
using arene::base::testing::rvalue_iterator< T >::iterator_category = std::random_access_iterator_tag

The iterator category; random access because we just store an index and yield from it.

◆ pointer

template<typename T>
using arene::base::testing::rvalue_iterator< T >::pointer = T*

The pointer type of the iterator; basically not meaningful, and it would be ill-formed to use it.

◆ reference

template<typename T>
using arene::base::testing::rvalue_iterator< T >::reference = T&&

The reference type of the iterator; a value of the expected type, since there's nothing to rvalue-refer to.

◆ value_type

template<typename T>
using arene::base::testing::rvalue_iterator< T >::value_type = T

The value type of the iterator; this is the type whose test values are being retrieved.

Constructor & Destructor Documentation

◆ rvalue_iterator() [1/3]

template<typename T>
arene::base::testing::rvalue_iterator< T >::rvalue_iterator ( difference_type index = 0)
inlineexplicitconstexprnoexcept

Construct an rvalue_iterator containing the test value with the given index (defaulting to 0)

Parameters
indexIndex to retrieve the test value with
Precondition
index >= 0, otherwise ARENE_PRECONDITION violation

◆ rvalue_iterator() [2/3]

template<typename T>
arene::base::testing::rvalue_iterator< T >::rvalue_iterator ( rvalue_iterator< T > const & other)
inlineconstexprnoexcept

Copy construct an rvalue_iterator, retrieving a new test value so that the value type can be move-only.

Parameters
otherIterator to copy from

◆ rvalue_iterator() [3/3]

template<typename T>
arene::base::testing::rvalue_iterator< T >::rvalue_iterator ( rvalue_iterator< T > && other)
inlineconstexprnoexcept

Move construct an rvalue_iterator.

Parameters
otherIterator to move from

◆ ~rvalue_iterator()

template<typename T>
arene::base::testing::rvalue_iterator< T >::~rvalue_iterator ( )
default

Destroy an rvalue_iterator.

Member Function Documentation

◆ operator*()

template<typename T>
auto arene::base::testing::rvalue_iterator< T >::operator* ( ) -> reference
inlineconstexprnoexcept

Dereference an rvalue_iterator; data may no longer be meaningful after the first use.

Returns
An rvalue reference to the current test value

◆ operator+=()

template<typename T>
auto arene::base::testing::rvalue_iterator< T >::operator+= ( difference_type diff) -> rvalue_iterator&
inlineconstexprnoexcept

Shift an rvalue_iterator by the given amount.

Parameters
diffAmount by which to shift the iterator
Returns
A reference to *this
Precondition
current_index_ + diff >= 0, otherwise ARENE_PRECONDITION violation

◆ operator=() [1/2]

template<typename T>
auto arene::base::testing::rvalue_iterator< T >::operator= ( rvalue_iterator< T > && other) -> rvalue_iterator&
inlineconstexprnoexcept

Move assign an rvalue_iterator.

Parameters
otherIterator to move from

◆ operator=() [2/2]

template<typename T>
auto arene::base::testing::rvalue_iterator< T >::operator= ( rvalue_iterator< T > const & other) -> rvalue_iterator&
inlineconstexprnoexcept

Copy assign an rvalue_iterator, retrieving a new test value so that the value type can be move-only.

Parameters
otherIterator to copy from

Friends And Related Symbol Documentation

◆ operator-

template<typename T>
auto operator- ( rvalue_iterator< T > const & left,
rvalue_iterator< T > const & right ) -> difference_type
friend

Get the difference between two rvalue_iterators.

Parameters
leftLeft side of the difference
rightRight side of the difference
Returns
The difference between the operands' respective current indices

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