OpenKalman
Classes | Public Member Functions | List of all members
OpenKalman::collections::replicate_view< V, Factor > Struct Template Reference

A view that replicates a collection some number of times. More...

#include <replicate.hpp>

Inheritance diagram for OpenKalman::collections::replicate_view< V, Factor >:
Inheritance graph
[legend]
Collaboration diagram for OpenKalman::collections::replicate_view< V, Factor >:
Collaboration graph
[legend]

Classes

struct  iterator
 Iterator for replicate_view. More...
 

Public Member Functions

template<bool Enable = true, std::enable_if_t< Enable and std::is_default_constructible_v< V > and std::is_default_constructible_v< Factor >, int > = 0>
constexpr replicate_view ()
 Default constructor.
 
constexpr replicate_view (V &v, Factor f)
 Construct from a collection.
 
constexpr replicate_view (V &&v, Factor f)
 
constexpr V & base () &
 The base view.
 
constexpr const V & base () const &
 
constexpr V && base () &&noexcept
 
constexpr const V && base () const &&noexcept
 
constexpr auto begin ()
 
template<bool Enable = true, std::enable_if_t< Enable and ranges::range< const V >, int > = 0>
constexpr auto begin () const
 
constexpr auto end ()
 
template<bool Enable = true, std::enable_if_t< Enable and ranges::range< const V >, int > = 0>
constexpr auto end () const noexcept
 
constexpr auto size () const
 
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< replicate_view< V, Factor > >
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 V, typename Factor>
struct OpenKalman::collections::replicate_view< V, Factor >

A view that replicates a collection some number of times.

The following should compile:

static_assert(std::tuple_size_v<replicate_view<std::tuple<int, double>, std::integral_constant<std::size_t, 3>>> == 6);
static_assert(std::is_same_v<std::tuple_element_t<5, replicate_view<std::tuple<double, int, float>, std::integral_constant<std::size_t, 2>>>, float>);
static_assert(get<3>(replicate_view {std::tuple{4, 5.}, std::integral_constant<std::size_t, 2>{}}) == 5);
static_assert((replicate_view {std::vector{3, 4, 5}, 2u}[4]), 4);
static_assert((replicate_view {std::vector{3, 4, 5}, 2u}[std::integral_constant<std::size_t, 5>{}]), 5);
See also
views::replicate

Constructor & Destructor Documentation

◆ replicate_view()

template<typename V , typename Factor >
constexpr OpenKalman::collections::replicate_view< V, Factor >::replicate_view ( V &&  v,
Factor  f 
)
inline

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

Member Function Documentation

◆ begin()

template<typename V , typename Factor >
constexpr auto OpenKalman::collections::replicate_view< V, Factor >::begin ( )
inline
Returns
An iterator at the beginning, if the base object is a range.

◆ end() [1/2]

template<typename V , typename Factor >
constexpr auto OpenKalman::collections::replicate_view< V, Factor >::end ( )
inline
Returns
An iterator at the end, if the base object is a range.

◆ end() [2/2]

template<typename V , typename Factor >
template<bool Enable = true, std::enable_if_t< Enable and ranges::range< const V >, int > = 0>
constexpr auto OpenKalman::collections::replicate_view< V, Factor >::end ( ) const
inlinenoexcept

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

◆ size()

template<typename V , typename Factor >
constexpr auto OpenKalman::collections::replicate_view< V, Factor >::size ( ) const
inline
Returns
The size of the object.

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