Skip to content

Class gl::util::concat_view

template <std::ranges::view V1, std::ranges::view V2>

ClassList > util > concat_view

A view concatenating two ranges sequentially (C++20 polyfill for C++26 std::views::concat ).More...

  • #include <gl/util/ranges.hpp>

Inherits the following classes: std::ranges::view_interface< concat_view< V1, V2 > >

Public Functions

Type Name
concat_view () = default
Default constructor creates an empty concatenated view.
constexpr concat_view (V1 v1, V2 v2)
Constructs a concat_view from two viewable ranges.
constexpr auto begin ()
Returns an iterator to the beginning of the concatenated view.
constexpr auto begin () const
Returns a const iterator to the beginning of the concatenated view.
constexpr auto end ()
Returns a sentinel representing the end of the concatenated view.
constexpr auto end () const
Returns a const sentinel representing the end of the concatenated view.

Detailed Description

GCC 13/14 Bug

Using branching views (like this or std::ranges::filter_view) inside complex algorithms (e.g., std::ranges::is_permutation) may trigger false-positive -Wmaybe-uninitialized warnings. To work around this, suppress the warning at the call site or materialize the view into a contiguous container like std::vector.

Template parameters:

  • V1 First view type.
  • V2 Second view type.

Todo

Replace with std::views::concat (C++26).

See Also

  • concat_fn: A helper compile-time constant function object for creating concat_view instances.
  • concat: A compile-time constant instantiation of this function object for convenient use.

Public Functions Documentation

function concat_view [1/2]

Default constructor creates an empty concatenated view.

util::concat_view::concat_view () = default


function concat_view [2/2]

Constructs a concat_view from two viewable ranges.

inline constexpr util::concat_view::concat_view (
    V1 v1,
    V2 v2
) 

Parameters:

  • v1 The first range to concatenate.
  • v2 The second range to concatenate.

function begin [1/2]

Returns an iterator to the beginning of the concatenated view.

inline constexpr  auto util::concat_view::begin () 

Returns:

An iterator that traverses the first range followed by the second range.


function begin [2/2]

Returns a const iterator to the beginning of the concatenated view.

inline constexpr  auto util::concat_view::begin () const

Returns:

A const iterator that traverses the first range followed by the second range.


function end [1/2]

Returns a sentinel representing the end of the concatenated view.

inline constexpr  auto util::concat_view::end () 

Returns:

A sentinel that compares equal to an iterator when it reaches the end of the second range.


function end [2/2]

Returns a const sentinel representing the end of the concatenated view.

inline constexpr  auto util::concat_view::end () const

Returns:

A const sentinel that compares equal to a const iterator when it reaches the end



The documentation for this class was generated from the following file include/gl/util/ranges.hpp