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

#include <functional_adapters.hpp>

Inheritance diagram for helios::utils::MapAdapter< Iter, Func >:
helios::utils::FunctionalAdapterBase< MapAdapter< Iter, Func > >

Public Types

using iterator_category = std::forward_iterator_tag
 
using value_type = typename DeduceValueType< 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 MapAdapter (Iter begin, Iter end, Func transform) noexcept(std::is_nothrow_move_constructible_v< Iter > &&std::is_nothrow_move_constructible_v< Func >)
 Constructs a map adapter with the given iterator range and transform function.
 
constexpr MapAdapter (const MapAdapter &) noexcept(std::is_nothrow_copy_constructible_v< Iter > &&std::is_nothrow_copy_constructible_v< Func >)=default
 
constexpr MapAdapter (MapAdapter &&) noexcept(std::is_nothrow_move_constructible_v< Iter > &&std::is_nothrow_move_constructible_v< Func >)=default
 
constexpr ~MapAdapter () noexcept(std::is_nothrow_destructible_v< Iter > &&std::is_nothrow_destructible_v< Func >)=default
 
constexpr MapAdapteroperator= (const MapAdapter &) noexcept(std::is_nothrow_copy_assignable_v< Iter > &&std::is_nothrow_copy_assignable_v< Func >)=default
 
constexpr MapAdapteroperator= (MapAdapter &&) noexcept(std::is_nothrow_move_assignable_v< Iter > &&std::is_nothrow_move_assignable_v< Func >)=default
 
constexpr MapAdapteroperator++ () noexcept(noexcept(++std::declval< Iter & >()))
 
constexpr MapAdapter operator++ (int) noexcept(std::is_nothrow_copy_constructible_v< MapAdapter > &&noexcept(++std::declval< MapAdapter & >()))
 
constexpr value_type operator* () const noexcept(std::is_nothrow_invocable_v< Func, std::iter_value_t< Iter > > &&noexcept(*std::declval< const Iter & >()))
 
constexpr bool operator== (const MapAdapter &other) const noexcept(noexcept(std::declval< const Iter & >()==std::declval< const Iter & >()))
 
constexpr bool operator!= (const MapAdapter &other) const noexcept(noexcept(std::declval< const MapAdapter & >()==std::declval< const MapAdapter & >()))
 
constexpr MapAdapter begin () const noexcept(std::is_nothrow_copy_constructible_v< MapAdapter >)
 
constexpr MapAdapter end () const noexcept(std::is_nothrow_constructible_v< MapAdapter, const Iter &, const Iter &, const Func & >)
 

Detailed Description

template<typename Iter, typename Func>
requires MapAdapterRequirements<Iter, Func>
class helios::utils::MapAdapter< Iter, Func >

Definition at line 527 of file functional_adapters.hpp.

Member Typedef Documentation

◆ difference_type

template<typename Iter , typename Func >
using helios::utils::MapAdapter< Iter, Func >::difference_type = std::iter_difference_t<Iter>

◆ iterator_category

template<typename Iter , typename Func >
using helios::utils::MapAdapter< Iter, Func >::iterator_category = std::forward_iterator_tag

◆ pointer

template<typename Iter , typename Func >
using helios::utils::MapAdapter< Iter, Func >::pointer = value_type*

◆ reference

template<typename Iter , typename Func >
using helios::utils::MapAdapter< Iter, Func >::reference = value_type

◆ value_type

template<typename Iter , typename Func >
using helios::utils::MapAdapter< Iter, Func >::value_type = typename DeduceValueType<std::iter_value_t<Iter> >::Type

Constructor & Destructor Documentation

◆ MapAdapter() [1/3]

template<typename Iter , typename Func >
constexpr helios::utils::MapAdapter< Iter, Func >::MapAdapter ( Iter  begin,
Iter  end,
Func  transform 
)
inlineconstexprnoexcept

Constructs a map adapter with the given iterator range and transform function.

Parameters
beginStart of the iterator range
endEnd of the iterator range
transformFunction to transform elements

Definition at line 556 of file functional_adapters.hpp.

558 : begin_(std::move(begin)), current_(begin_), end_(std::move(end)), transform_(std::move(transform)) {}
constexpr MapAdapter end() const noexcept(std::is_nothrow_constructible_v< MapAdapter, const Iter &, const Iter &, const Func & >)
constexpr MapAdapter begin() const noexcept(std::is_nothrow_copy_constructible_v< MapAdapter >)

◆ MapAdapter() [2/3]

template<typename Iter , typename Func >
constexpr helios::utils::MapAdapter< Iter, Func >::MapAdapter ( const MapAdapter< Iter, Func > &  ) const &&
constexprdefaultnoexcept

◆ MapAdapter() [3/3]

template<typename Iter , typename Func >
constexpr helios::utils::MapAdapter< Iter, Func >::MapAdapter ( MapAdapter< Iter, Func > &&  ) const &&
constexprdefaultnoexcept

◆ ~MapAdapter()

template<typename Iter , typename Func >
constexpr helios::utils::MapAdapter< Iter, Func >::~MapAdapter ( ) &&
constexprdefaultnoexcept

Member Function Documentation

◆ begin()

template<typename Iter , typename Func >
constexpr MapAdapter helios::utils::MapAdapter< Iter, Func >::begin ( ) const
inlineconstexprnoexcept

◆ end()

template<typename Iter , typename Func >
constexpr MapAdapter helios::utils::MapAdapter< Iter, Func >::end ( ) const
inlineconstexprnoexcept
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/utils/functional_adapters.hpp.

Definition at line 592 of file functional_adapters.hpp.

593 {
594 return {end_, end_, transform_};
595 }

◆ operator!=()

template<typename Iter , typename Func >
constexpr bool helios::utils::MapAdapter< Iter, Func >::operator!= ( const MapAdapter< Iter, Func > &  other) const
inlineconstexprnoexcept

◆ operator*()

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

Definition at line 622 of file functional_adapters.hpp.

624 {
625 auto value = *current_;
626 if constexpr (std::invocable<Func, decltype(value)>) {
627 return transform_(value);
628 } else {
629 return std::apply(transform_, value);
630 }
631}

◆ operator++() [1/2]

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

Definition at line 606 of file functional_adapters.hpp.

606 {
607 ++current_;
608 return *this;
609}

◆ operator++() [2/2]

template<typename Iter , typename Func >
requires MapAdapterRequirements<Iter, Func>
constexpr auto helios::utils::MapAdapter< Iter, Func >::operator++ ( int  )
constexprnoexcept

Definition at line 613 of file functional_adapters.hpp.

614 {
615 auto temp = *this;
616 ++(*this);
617 return temp;
618}

◆ operator=() [1/2]

template<typename Iter , typename Func >
constexpr MapAdapter & helios::utils::MapAdapter< Iter, Func >::operator= ( const MapAdapter< Iter, Func > &  ) &&
constexprdefaultnoexcept

◆ operator=() [2/2]

template<typename Iter , typename Func >
constexpr MapAdapter & helios::utils::MapAdapter< Iter, Func >::operator= ( MapAdapter< Iter, Func > &&  ) &&
constexprdefaultnoexcept

◆ operator==()

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

Definition at line 579 of file functional_adapters.hpp.

580 {
581 return current_ == other.current_;
582 }