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

#include <functional_adapters.hpp>

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

Public Types

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

Public Member Functions

constexpr InspectAdapter (Iter begin, Iter end, Func inspector) noexcept(std::is_nothrow_move_constructible_v< Iter > &&std::is_nothrow_copy_constructible_v< Iter > &&std::is_nothrow_move_constructible_v< Func >)
 Constructs an inspect adapter with the given iterator range and inspector function.
 
constexpr InspectAdapter (const InspectAdapter &) noexcept(std::is_nothrow_copy_constructible_v< Iter > &&std::is_nothrow_copy_constructible_v< Func >)=default
 
constexpr InspectAdapter (InspectAdapter &&) noexcept(std::is_nothrow_move_constructible_v< Iter > &&std::is_nothrow_move_constructible_v< Func >)=default
 
constexpr ~InspectAdapter () noexcept(std::is_nothrow_destructible_v< Iter > &&std::is_nothrow_destructible_v< Func >)=default
 
constexpr InspectAdapteroperator= (const InspectAdapter &) noexcept(std::is_nothrow_copy_assignable_v< Iter > &&std::is_nothrow_copy_assignable_v< Func >)=default
 
constexpr InspectAdapteroperator= (InspectAdapter &&) noexcept(std::is_nothrow_move_assignable_v< Iter > &&std::is_nothrow_move_assignable_v< Func >)=default
 
constexpr InspectAdapteroperator++ () noexcept(noexcept(++std::declval< Iter & >()))
 
constexpr InspectAdapter operator++ (int) noexcept(std::is_nothrow_copy_constructible_v< InspectAdapter > &&noexcept(++std::declval< InspectAdapter & >()))
 
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 InspectAdapter &other) const noexcept(noexcept(std::declval< const Iter & >()==std::declval< const Iter & >()))
 
constexpr bool operator!= (const InspectAdapter &other) const noexcept(noexcept(std::declval< const InspectAdapter & >()==std::declval< const InspectAdapter & >()))
 
constexpr InspectAdapter begin () const noexcept(std::is_nothrow_copy_constructible_v< InspectAdapter >)
 
constexpr InspectAdapter end () const noexcept(std::is_nothrow_constructible_v< InspectAdapter, const Iter &, const Iter &, const Func & >)
 

Detailed Description

template<typename Iter, typename Func>
requires InspectAdapterRequirements<Iter, Func>
class helios::utils::InspectAdapter< Iter, Func >

Definition at line 1259 of file functional_adapters.hpp.

Member Typedef Documentation

◆ difference_type

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

◆ iterator_category

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

◆ pointer

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

◆ reference

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

◆ value_type

template<typename Iter , typename Func >
using helios::utils::InspectAdapter< Iter, Func >::value_type = std::iter_value_t<Iter>

Constructor & Destructor Documentation

◆ InspectAdapter() [1/3]

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

Constructs an inspect adapter with the given iterator range and inspector function.

Parameters
beginStart of the iterator range
endEnd of the iterator range
inspectorFunction to call for each element

Definition at line 1273 of file functional_adapters.hpp.

1276 : begin_(std::move(begin)), current_(begin_), end_(std::move(end)), inspector_(std::move(inspector)) {}
constexpr InspectAdapter begin() const noexcept(std::is_nothrow_copy_constructible_v< InspectAdapter >)
constexpr InspectAdapter end() const noexcept(std::is_nothrow_constructible_v< InspectAdapter, const Iter &, const Iter &, const Func & >)

◆ InspectAdapter() [2/3]

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

◆ InspectAdapter() [3/3]

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

◆ ~InspectAdapter()

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

Member Function Documentation

◆ begin()

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

◆ end()

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

Definition at line 1311 of file functional_adapters.hpp.

1312 {
1313 return {end_, end_, inspector_};
1314 }

◆ operator!=()

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

Definition at line 1302 of file functional_adapters.hpp.

1303 {
1304 return !(*this == other);
1305 }

◆ operator*()

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

Definition at line 1342 of file functional_adapters.hpp.

1344 {
1345 auto value = *current_;
1346 if constexpr (std::invocable<Func, decltype(value)>) {
1347 inspector_(value);
1348 } else {
1349 std::apply(inspector_, value);
1350 }
1351 return value;
1352}

◆ operator++() [1/2]

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

Definition at line 1325 of file functional_adapters.hpp.

1325 {
1326 ++current_;
1327 return *this;
1328}

◆ operator++() [2/2]

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

Definition at line 1332 of file functional_adapters.hpp.

1334 {
1335 auto temp = *this;
1336 ++(*this);
1337 return temp;
1338}

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ operator==()

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

Definition at line 1297 of file functional_adapters.hpp.

1298 {
1299 return current_ == other.current_;
1300 }