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

#include <functional_adapters.hpp>

Inheritance diagram for helios::utils::ChainAdapter< Iter1, Iter2 >:
helios::utils::FunctionalAdapterBase< ChainAdapter< Iter1, Iter2 > >

Public Types

using iterator_category = std::forward_iterator_tag
 
using value_type = std::iter_value_t< Iter1 >
 
using difference_type = std::common_type_t< std::iter_difference_t< Iter1 >, std::iter_difference_t< Iter2 > >
 
using pointer = value_type *
 
using reference = value_type
 

Public Member Functions

constexpr ChainAdapter (Iter1 first_begin, Iter1 first_end, Iter2 second_begin, Iter2 second_end) noexcept(std::is_nothrow_move_constructible_v< Iter1 > &&std::is_nothrow_move_constructible_v< Iter2 > &&noexcept(std::declval< Iter1 & >() !=std::declval< Iter1 & >()))
 Constructs a chain adapter with two iterator ranges.
 
constexpr ChainAdapter (const ChainAdapter &) noexcept(std::is_nothrow_copy_constructible_v< Iter1 > &&std::is_nothrow_copy_constructible_v< Iter2 >)=default
 
constexpr ChainAdapter (ChainAdapter &&) noexcept(std::is_nothrow_move_constructible_v< Iter1 > &&std::is_nothrow_move_constructible_v< Iter2 >)=default
 
constexpr ~ChainAdapter () noexcept(std::is_nothrow_destructible_v< Iter1 > &&std::is_nothrow_destructible_v< Iter2 >)=default
 
constexpr ChainAdapteroperator= (const ChainAdapter &) noexcept(std::is_nothrow_copy_assignable_v< Iter1 > &&std::is_nothrow_copy_assignable_v< Iter2 >)=default
 
constexpr ChainAdapteroperator= (ChainAdapter &&) noexcept(std::is_nothrow_move_assignable_v< Iter1 > &&std::is_nothrow_move_assignable_v< Iter2 >)=default
 
constexpr ChainAdapteroperator++ () noexcept(noexcept(++std::declval< Iter1 & >()) &&noexcept(++std::declval< Iter2 & >()) &&noexcept(std::declval< Iter1 & >()==std::declval< Iter1 & >()) &&noexcept(std::declval< Iter2 & >() !=std::declval< Iter2 & >()))
 
constexpr ChainAdapter operator++ (int) noexcept(std::is_nothrow_copy_constructible_v< ChainAdapter > &&noexcept(++std::declval< ChainAdapter & >()))
 
constexpr value_type operator* () const noexcept(noexcept(*std::declval< const Iter1 & >()) &&noexcept(*std::declval< const Iter2 & >()))
 
constexpr bool operator== (const ChainAdapter &other) const noexcept(noexcept(std::declval< const Iter1 & >()==std::declval< const Iter1 & >()) &&noexcept(std::declval< const Iter2 & >()==std::declval< const Iter2 & >()))
 
constexpr bool operator!= (const ChainAdapter &other) const noexcept(noexcept(std::declval< const ChainAdapter & >()==std::declval< const ChainAdapter & >()))
 
constexpr ChainAdapter begin () const noexcept(std::is_nothrow_copy_constructible_v< ChainAdapter >)
 
constexpr ChainAdapter end () const noexcept(std::is_nothrow_copy_constructible_v< ChainAdapter > &&std::is_nothrow_copy_constructible_v< Iter1 > &&std::is_nothrow_copy_constructible_v< Iter2 >)
 

Detailed Description

template<typename Iter1, typename Iter2>
requires ChainAdapterRequirements<Iter1, Iter2>
class helios::utils::ChainAdapter< Iter1, Iter2 >

Definition at line 1465 of file functional_adapters.hpp.

Member Typedef Documentation

◆ difference_type

template<typename Iter1 , typename Iter2 >
using helios::utils::ChainAdapter< Iter1, Iter2 >::difference_type = std::common_type_t<std::iter_difference_t<Iter1>, std::iter_difference_t<Iter2> >

◆ iterator_category

template<typename Iter1 , typename Iter2 >
using helios::utils::ChainAdapter< Iter1, Iter2 >::iterator_category = std::forward_iterator_tag

◆ pointer

template<typename Iter1 , typename Iter2 >
using helios::utils::ChainAdapter< Iter1, Iter2 >::pointer = value_type*

◆ reference

template<typename Iter1 , typename Iter2 >
using helios::utils::ChainAdapter< Iter1, Iter2 >::reference = value_type

◆ value_type

template<typename Iter1 , typename Iter2 >
using helios::utils::ChainAdapter< Iter1, Iter2 >::value_type = std::iter_value_t<Iter1>

Constructor & Destructor Documentation

◆ ChainAdapter() [1/3]

template<typename Iter1 , typename Iter2 >
constexpr helios::utils::ChainAdapter< Iter1, Iter2 >::ChainAdapter ( Iter1  first_begin,
Iter1  first_end,
Iter2  second_begin,
Iter2  second_end 
)
inlineconstexprnoexcept

Constructs a chain adapter with two iterator ranges.

Parameters
first_beginStart of the first iterator range
first_endEnd of the first iterator range
second_beginStart of the second iterator range
second_endEnd of the second iterator range

Definition at line 1480 of file functional_adapters.hpp.

1484 : first_current_(std::move(first_begin)),
1485 first_end_(std::move(first_end)),
1486 second_current_(std::move(second_begin)),
1487 second_end_(std::move(second_end)),
1488 in_first_(first_current_ != first_end_) {}

◆ ChainAdapter() [2/3]

template<typename Iter1 , typename Iter2 >
constexpr helios::utils::ChainAdapter< Iter1, Iter2 >::ChainAdapter ( const ChainAdapter< Iter1, Iter2 > &  ) const &&
constexprdefaultnoexcept

◆ ChainAdapter() [3/3]

template<typename Iter1 , typename Iter2 >
constexpr helios::utils::ChainAdapter< Iter1, Iter2 >::ChainAdapter ( ChainAdapter< Iter1, Iter2 > &&  ) const &&
constexprdefaultnoexcept

◆ ~ChainAdapter()

template<typename Iter1 , typename Iter2 >
constexpr helios::utils::ChainAdapter< Iter1, Iter2 >::~ChainAdapter ( ) &&
constexprdefaultnoexcept

Member Function Documentation

◆ begin()

template<typename Iter1 , typename Iter2 >
constexpr ChainAdapter helios::utils::ChainAdapter< Iter1, Iter2 >::begin ( ) const
inlineconstexprnoexcept

◆ end()

template<typename Iter1 , typename Iter2 >
requires ChainAdapterRequirements<Iter1, Iter2>
constexpr auto helios::utils::ChainAdapter< Iter1, Iter2 >::end ( ) const
constexprnoexcept
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/utils/functional_adapters.hpp.

Definition at line 1590 of file functional_adapters.hpp.

1592 {
1593 auto end_iter = *this;
1594 end_iter.first_current_ = first_end_;
1595 end_iter.second_current_ = second_end_;
1596 end_iter.in_first_ = false;
1597 return end_iter;
1598}

◆ operator!=()

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

Definition at line 1518 of file functional_adapters.hpp.

1519 {
1520 return !(*this == other);
1521 }

◆ operator*()

template<typename Iter1 , typename Iter2 >
constexpr value_type helios::utils::ChainAdapter< Iter1, Iter2 >::operator* ( ) const
inlineconstexprnoexcept
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/utils/functional_adapters.hpp.

Definition at line 1509 of file functional_adapters.hpp.

1510 {
1511 return in_first_ ? *first_current_ : *second_current_;
1512 }

◆ operator++() [1/2]

template<typename Iter1 , typename Iter2 >
requires ChainAdapterRequirements<Iter1, Iter2>
constexpr auto helios::utils::ChainAdapter< Iter1, Iter2 >::operator++ ( )
constexprnoexcept
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/utils/functional_adapters.hpp.

Definition at line 1541 of file functional_adapters.hpp.

1544 {
1545 if (in_first_) {
1546 ++first_current_;
1547 if (first_current_ == first_end_) {
1548 in_first_ = false;
1549 }
1550 } else {
1551 if (second_current_ != second_end_) {
1552 ++second_current_;
1553 }
1554 }
1555 return *this;
1556}

◆ operator++() [2/2]

template<typename Iter1 , typename Iter2 >
requires ChainAdapterRequirements<Iter1, Iter2>
constexpr auto helios::utils::ChainAdapter< Iter1, Iter2 >::operator++ ( int  )
constexprnoexcept

Definition at line 1560 of file functional_adapters.hpp.

1561 {
1562 auto temp = *this;
1563 ++(*this);
1564 return temp;
1565}

◆ operator=() [1/2]

template<typename Iter1 , typename Iter2 >
constexpr ChainAdapter & helios::utils::ChainAdapter< Iter1, Iter2 >::operator= ( ChainAdapter< Iter1, Iter2 > &&  ) &&
constexprdefaultnoexcept

◆ operator=() [2/2]

template<typename Iter1 , typename Iter2 >
constexpr ChainAdapter & helios::utils::ChainAdapter< Iter1, Iter2 >::operator= ( const ChainAdapter< Iter1, Iter2 > &  ) &&
constexprdefaultnoexcept

◆ operator==()

template<typename Iter1 , typename Iter2 >
requires ChainAdapterRequirements<Iter1, Iter2>
constexpr bool helios::utils::ChainAdapter< Iter1, Iter2 >::operator== ( const ChainAdapter< Iter1, Iter2 > &  other) const
constexprnoexcept
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/utils/functional_adapters.hpp.

Definition at line 1569 of file functional_adapters.hpp.

1571 {
1572 // Check if both are at end (in second range and at second_end_)
1573 const bool this_at_end = !in_first_ && (second_current_ == second_end_);
1574 const bool other_at_end = !other.in_first_ && (other.second_current_ == other.second_end_);
1575
1576 if (this_at_end && other_at_end) {
1577 return true;
1578 }
1579
1580 // Otherwise, must be in same range at same position
1581 if (in_first_ != other.in_first_) {
1582 return false;
1583 }
1584
1585 return in_first_ ? (first_current_ == other.first_current_) : (second_current_ == other.second_current_);
1586}