Helios Engine 0.1.0
A modular ECS based data-oriented C++23 game engine
 
Loading...
Searching...
No Matches
helios::utils::EnumerateAdapter< Iter > Class Template Reference

#include <functional_adapters.hpp>

Inheritance diagram for helios::utils::EnumerateAdapter< Iter >:
helios::utils::FunctionalAdapterBase< EnumerateAdapter< Iter > >

Public Types

using iterator_category = std::forward_iterator_tag
 
using value_type = typename MakeEnumeratedValue< std::iter_value_t< Iter > >::type
 
using difference_type = std::iter_difference_t< Iter >
 
using pointer = value_type *
 
using reference = value_type
 

Public Member Functions

constexpr EnumerateAdapter (Iter begin, Iter end) noexcept(std::is_nothrow_move_constructible_v< Iter > &&std::is_nothrow_copy_constructible_v< Iter >)
 Constructs an enumerate adapter with the given iterator range.
 
constexpr EnumerateAdapter (const EnumerateAdapter &)=default
 
constexpr EnumerateAdapter (EnumerateAdapter &&)=default
 
constexpr ~EnumerateAdapter ()=default
 
constexpr EnumerateAdapteroperator= (const EnumerateAdapter &)=default
 
constexpr EnumerateAdapteroperator= (EnumerateAdapter &&)=default
 
constexpr EnumerateAdapteroperator++ () noexcept(noexcept(++std::declval< Iter & >()))
 
constexpr EnumerateAdapter operator++ (int) noexcept(std::is_nothrow_copy_constructible_v< EnumerateAdapter > &&noexcept(++std::declval< EnumerateAdapter & >()))
 
constexpr value_type operator* () const
 
constexpr bool operator== (const EnumerateAdapter &other) const noexcept(noexcept(std::declval< const Iter & >()==std::declval< const Iter & >()))
 
constexpr bool operator!= (const EnumerateAdapter &other) const noexcept(noexcept(std::declval< const EnumerateAdapter & >()==std::declval< const EnumerateAdapter & >()))
 
constexpr EnumerateAdapter begin () const noexcept(std::is_nothrow_copy_constructible_v< EnumerateAdapter >)
 
constexpr EnumerateAdapter end () const noexcept(std::is_nothrow_constructible_v< EnumerateAdapter, const Iter &, const Iter & >)
 

Detailed Description

template<typename Iter>
requires EnumerateAdapterRequirements<Iter>
class helios::utils::EnumerateAdapter< Iter >

Definition at line 1147 of file functional_adapters.hpp.

Member Typedef Documentation

◆ difference_type

template<typename Iter >
using helios::utils::EnumerateAdapter< Iter >::difference_type = std::iter_difference_t<Iter>

◆ iterator_category

template<typename Iter >
using helios::utils::EnumerateAdapter< Iter >::iterator_category = std::forward_iterator_tag

◆ pointer

◆ reference

◆ value_type

template<typename Iter >
using helios::utils::EnumerateAdapter< Iter >::value_type = typename MakeEnumeratedValue<std::iter_value_t<Iter> >::type

Constructor & Destructor Documentation

◆ EnumerateAdapter() [1/3]

template<typename Iter >
constexpr helios::utils::EnumerateAdapter< Iter >::EnumerateAdapter ( Iter  begin,
Iter  end 
)
inlineconstexprnoexcept

Constructs an enumerate adapter with the given iterator range.

Parameters
beginStart of the iterator range
endEnd of the iterator range

Definition at line 1171 of file functional_adapters.hpp.

1173 : begin_(std::move(begin)), current_(begin_), end_(std::move(end)) {}
constexpr EnumerateAdapter begin() const noexcept(std::is_nothrow_copy_constructible_v< EnumerateAdapter >)
constexpr EnumerateAdapter end() const noexcept(std::is_nothrow_constructible_v< EnumerateAdapter, const Iter &, const Iter & >)

◆ EnumerateAdapter() [2/3]

template<typename Iter >
constexpr helios::utils::EnumerateAdapter< Iter >::EnumerateAdapter ( const EnumerateAdapter< Iter > &  )
constexprdefault

◆ EnumerateAdapter() [3/3]

template<typename Iter >
constexpr helios::utils::EnumerateAdapter< Iter >::EnumerateAdapter ( EnumerateAdapter< Iter > &&  )
constexprdefault

◆ ~EnumerateAdapter()

Member Function Documentation

◆ begin()

template<typename Iter >
constexpr EnumerateAdapter helios::utils::EnumerateAdapter< Iter >::begin ( ) const
inlineconstexprnoexcept

◆ end()

template<typename Iter >
constexpr EnumerateAdapter helios::utils::EnumerateAdapter< Iter >::end ( ) const
inlineconstexprnoexcept

◆ operator!=()

template<typename Iter >
constexpr bool helios::utils::EnumerateAdapter< Iter >::operator!= ( const EnumerateAdapter< Iter > &  other) const
inlineconstexprnoexcept
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/utils/functional_adapters.hpp.

Definition at line 1193 of file functional_adapters.hpp.

1194 {
1195 return !(*this == other);
1196 }

◆ operator*()

template<typename Iter >
requires EnumerateAdapterRequirements<Iter>
constexpr auto helios::utils::EnumerateAdapter< Iter >::operator* ( ) const
constexpr
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/utils/functional_adapters.hpp.

Definition at line 1235 of file functional_adapters.hpp.

1235 {
1236 auto value = *current_;
1237 if constexpr (details::TupleLike<decltype(value)>) {
1238 return std::tuple_cat(std::tuple{index_}, value);
1239 } else {
1240 return std::tuple{index_, value};
1241 }
1242}

◆ operator++() [1/2]

template<typename Iter >
requires EnumerateAdapterRequirements<Iter>
constexpr auto helios::utils::EnumerateAdapter< Iter >::operator++ ( )
constexprnoexcept
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/utils/functional_adapters.hpp.

Definition at line 1217 of file functional_adapters.hpp.

1217 {
1218 ++current_;
1219 ++index_;
1220 return *this;
1221}

◆ operator++() [2/2]

template<typename Iter >
requires EnumerateAdapterRequirements<Iter>
constexpr auto helios::utils::EnumerateAdapter< Iter >::operator++ ( int  )
constexprnoexcept

Definition at line 1225 of file functional_adapters.hpp.

1227 {
1228 auto temp = *this;
1229 ++(*this);
1230 return temp;
1231}

◆ operator=() [1/2]

◆ operator=() [2/2]

template<typename Iter >
constexpr EnumerateAdapter & helios::utils::EnumerateAdapter< Iter >::operator= ( EnumerateAdapter< Iter > &&  )
constexprdefault

◆ operator==()

template<typename Iter >
constexpr bool helios::utils::EnumerateAdapter< Iter >::operator== ( const EnumerateAdapter< Iter > &  other) const
inlineconstexprnoexcept
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/utils/functional_adapters.hpp.

Definition at line 1188 of file functional_adapters.hpp.

1189 {
1190 return current_ == other.current_;
1191 }