OpenKalman
Classes | Public Member Functions | List of all members
OpenKalman::collections::generate_view< F, Size > Struct Template Reference

A collection_view created by lazily generating elements based on an index. More...

#include <generate.hpp>

Inheritance diagram for OpenKalman::collections::generate_view< F, Size >:
Inheritance graph
[legend]
Collaboration diagram for OpenKalman::collections::generate_view< F, Size >:
Collaboration graph
[legend]

Classes

struct  iterator
 Iterator for generate_view. More...
 

Public Member Functions

template<typename Arg , std::enable_if_t< std::is_constructible_v< const F, Arg &&> and values::index< Size >, int > = 0>
constexpr generate_view (Arg &&arg, Size_ size) noexcept
 Construct from a callable object and a size.
 
template<bool Enable = true, std::enable_if_t< Enable and static_F and(not values::index< Size >), int > = 0>
constexpr generate_view (const F &) noexcept
 Construct from a statically constructable callable object, if the view is unsized.
 
template<bool Enable = true, typename Arg , std::enable_if_t< Enable and std::is_constructible_v< const F, Arg &&> and not static_F and(not values::index< Size >), int > = 0>
constexpr generate_view (Arg &&arg) noexcept
 Construct from a callable object, if the view is unsized.
 
template<bool Enable = true, std::enable_if_t< Enable and static_F and values::index< Size >, int > = 0>
constexpr generate_view (Size_ size) noexcept
 Construct from a size if the function can be defined statically.
 
constexpr generate_view ()=default
 Default constructor.
 
constexpr auto begin ()
 
constexpr auto begin () const
 
constexpr auto end ()
 
constexpr auto end () const
 
template<bool Enable = true, std::enable_if_t< Enable and(values::index< Size >), int > = 0>
constexpr auto size () const noexcept
 The size of the resulting object.
 
template<std::size_t i>
decltype(auto) constexpr get () &
 Get element i.
 
template<std::size_t i>
decltype(auto) constexpr get () const &
 
template<std::size_t i>
decltype(auto) constexpr get () &&noexcept
 
template<std::size_t i>
decltype(auto) constexpr get () const &&noexcept
 
- Public Member Functions inherited from OpenKalman::ranges::view_interface< generate_view< F, Size > >
constexpr bool empty ()
 
constexpr bool empty () const
 
constexpr auto cbegin ()
 
constexpr auto cbegin () const
 
constexpr auto cend ()
 
constexpr auto cend () const
 
constexpr operator bool ()
 
constexpr operator bool () const
 
constexpr auto size ()
 
constexpr auto size () const
 
decltype(auto) constexpr front ()
 
decltype(auto) constexpr front () const
 
decltype(auto) constexpr back ()
 
decltype(auto) constexpr back () const
 
decltype(auto) constexpr operator[] (range_difference_t< D > n)
 
decltype(auto) constexpr operator[] (range_difference_t< D > n) const
 

Detailed Description

template<typename F, typename Size = unreachable_sentinel_t>
struct OpenKalman::collections::generate_view< F, Size >

A collection_view created by lazily generating elements based on an index.

Typically, the generating function will be a closure.

Template Parameters
FA callable object (possibly a closure) taking an index and producing an output value corresponding to the index.
SizeThe size of the output collection. If it is void, the view is unsized.

Member Function Documentation

◆ begin() [1/2]

template<typename F, typename Size = unreachable_sentinel_t>
constexpr auto OpenKalman::collections::generate_view< F, Size >::begin ( )
inline
Returns
An iterator at the beginning, if the base object is a range.

◆ begin() [2/2]

template<typename F, typename Size = unreachable_sentinel_t>
constexpr auto OpenKalman::collections::generate_view< F, Size >::begin ( ) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ end() [1/2]

template<typename F, typename Size = unreachable_sentinel_t>
constexpr auto OpenKalman::collections::generate_view< F, Size >::end ( )
inline
Returns
An iterator at the end, if the base object is a range.

◆ end() [2/2]

template<typename F, typename Size = unreachable_sentinel_t>
constexpr auto OpenKalman::collections::generate_view< F, Size >::end ( ) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.


The documentation for this struct was generated from the following file: