emlabcpp
modern opinionated embedded C++ library
emlabcpp::impl Namespace Reference

MIT License. More...

Classes

struct  map_f_collector
 
struct  map_f_collector< T >
 
struct  map_f_collector< std::array< T, N > >
 
struct  is_view
 
struct  is_view< T >
 
struct  is_std_tuple
 
struct  is_std_tuple< std::tuple< T... > >
 
struct  is_std_array
 
struct  is_std_array< std::array< T, N > >
 
struct  is_std_vector
 
struct  is_std_vector< std::vector< T > >
 
struct  static_size
 
struct  static_size< std::array< T, N > >
 
struct  static_size< std::tuple< Ts... > >
 
struct  is_view< view< Iter > >
 Support for our deduction guide to types - is_view_v. More...
 

Functions

template<typename... Args, typename UnaryPredicate , std::size_t... Idx>
constexpr std::size_t find_if_impl (std::tuple< Args... > const &t, UnaryPredicate &&f, std::index_sequence< Idx... >)
 
template<typename T , std::size_t N, range_container Container, typename UnaryCallable , std::size_t... Is>
std::array< T, Nmap_f_to_a_impl (Container &&cont, UnaryCallable &&f, std::integer_sequence< std::size_t, Is... >)
 
template<typename T , std::size_t N, gettable_container Container, typename UnaryCallable , std::size_t... Is>
 requires (!range_container< Container >) std
 
template<typename T >
requires requires (T a, typename T::value_type b)
 
template<std::size_t I, typename T >
constexpr auto get_ith_item_from_arrays (T &arr, auto &... arrays)
 
template<std::size_t Off, std::size_t N, typename F >
constexpr decltype(auto) index_switch (std::size_t i, F &&f)
 Executes f<i> if provided i matches. More...
 
template<std::size_t Off, std::size_t N, typename F >
constexpr void index_seq (F &&f)
 Executes f<i> for i going from Off to N. More...
 
template<std::size_t Off, std::size_t N, typename F >
constexpr bool index_until (F &&f)
 Executes f<i> until some is true. More...
 

Variables

template<typename T >
concept map_f_collectable
 

Detailed Description

MIT License.

Copyright (c) 2025 Jan Veverak Koniarik

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


is_view<T>::value marks whenever is some type of temporary view - not owning of the data


is_std_tuple<T>::value is true if type T is std::tuple


is_std_array<T>::value is true if type T is std::array


is_std_vector<T>::value is true if type T is std::vector


static_size<T>::value is size of the type T, if it has any deducable at compile time


Class Documentation

◆ emlabcpp::impl::map_f_collector

struct emlabcpp::impl::map_f_collector

template<typename>
struct emlabcpp::impl::map_f_collector< typename >

◆ emlabcpp::impl::static_size

struct emlabcpp::impl::static_size

template<typename>
struct emlabcpp::impl::static_size< typename >

Function Documentation

◆ find_if_impl()

template<typename... Args, typename UnaryPredicate , std::size_t... Idx>
constexpr std::size_t emlabcpp::impl::find_if_impl ( std::tuple< Args... > const &  t,
UnaryPredicate &&  f,
std::index_sequence< Idx... >   
)
constexpr

References emlabcpp::f, and emlabcpp::res.

◆ get_ith_item_from_arrays()

template<std::size_t I, typename T >
constexpr auto emlabcpp::impl::get_ith_item_from_arrays ( T &  arr,
auto &...  arrays 
)
constexpr

◆ index_seq()

template<std::size_t Off, std::size_t N, typename F >
constexpr void emlabcpp::impl::index_seq ( F &&  f)
constexpr

Executes f<i> for i going from Off to N.

References EMLABCPP_INDEX_EXPAND, EMLABCPP_INDEX_MAX, EMLABCPP_INDEX_SEQ, emlabcpp::f, and emlabcpp::N.

◆ index_switch()

template<std::size_t Off, std::size_t N, typename F >
constexpr decltype( auto ) emlabcpp::impl::index_switch ( std::size_t  i,
F &&  f 
)
constexpr

Executes f<i> if provided i matches.

References EMLABCPP_INDEX_EXPAND, EMLABCPP_INDEX_MAX, EMLABCPP_INDEX_SWITCH_CASE, emlabcpp::f, and emlabcpp::N.

◆ index_until()

template<std::size_t Off, std::size_t N, typename F >
constexpr bool emlabcpp::impl::index_until ( F &&  f)
constexpr

Executes f<i> until some is true.

References EMLABCPP_INDEX_EXPAND, EMLABCPP_INDEX_MAX, EMLABCPP_INDEX_UNTIL, emlabcpp::f, and emlabcpp::N.

◆ map_f_to_a_impl()

template<typename T , std::size_t N, range_container Container, typename UnaryCallable , std::size_t... Is>
std::array< T, N > emlabcpp::impl::map_f_to_a_impl ( Container &&  cont,
UnaryCallable &&  f,
std::integer_sequence< std::size_t, Is... >   
)

https://en.cppreference.com/w/cpp/language/eval_order based on standard the order of process(i) calls is defined only in case we are using constructor initializer with {} brackets. Otherwise it can be any order ...

References emlabcpp::f.

◆ requires() [1/2]

template<typename T , std::size_t N, gettable_container Container, typename UnaryCallable , std::size_t... Is>
emlabcpp::impl::requires ( !range_container< Container >  )

viz. second map_f_to_a_impl

References emlabcpp::f.

◆ requires() [2/2]

template<typename T >
requires emlabcpp::impl::requires ( a,
typename T::value_type  b 
)

Variable Documentation

◆ map_f_collectable

template<typename T >
concept emlabcpp::impl::map_f_collectable
Initial value:
= requires( T item, typename T::value_type val ) {
map_f_collector< T >{}.collect( item, std::move( val ) );
}
requires requires(T a, typename T::value_type b)
Definition: impl.h:108
std::variant< int64_t, float, bool, string_buffer > value_type
Definition: base.h:51