Loading...
Searching...
No Matches
Namespaces | Typedefs | Functions | Variables
named_util.h File Reference

Additional convenience methods for named tuples. More...

#include "util/named.h"

Go to the source code of this file.

Namespaces

namespace  bbm
 

Typedefs

template<typename T >
using value_copy_named_t = decltype(value_copy_named(std::declval< T >()))
 type of value copying a named typle
 
template<typename... T>
using named_cat_t = decltype(named_cat(std::declval< T >()...))
 type of concatting multiple named tuples.
 
template<size_t START, size_t COUNT, typename NAMED >
using subnamed_t = decltype(subnamed< START, COUNT, NAMED >(std::declval< NAMED >()))
 type of subnamed
 
template<string_literal PREFIX, typename T >
using prefix_names_t = decltype(prefix_names< PREFIX >(std::declval< T >()))
 type of named tuple with pre-fixed name.
 
template<string_literal POSTFIX, typename T >
using postfix_names_t = decltype(post_names< POSTFIX >(std::declval< T >()))
 type of named tuple with post-fixed name.
 

Functions

template<typename TUP , string_literal... NAMES>
requires bbm::is_tuple_v<TUP>
constexpr auto value_copy_named (const named< TUP, NAMES... > &src)
 value copy a named tuple
 
template<typename... T>
requires (is_named_v<T> && ...)
constexpr auto named_cat (T &&... t)
 cat named types
 
template<size_t START, size_t COUNT, typename NAMED >
requires is_named_v<NAMED> && ((START+COUNT) <= std::decay_t<NAMED>::size)
constexpr auto subnamed (NAMED &&named)
 get a subset of a named tuple
 
template<string_literal PREFIX, typename T , string_literal... NAMES>
constexpr auto prefix_names (named< T, NAMES... > t)
 prefix names in type
 
template<string_literal POSTFIX, typename T , string_literal... NAMES>
constexpr auto postfix_names (named< T, NAMES... > t)
 postfix names in type
 
template<typename T >
requires is_named_v<T>
constexpr auto named_flatten (T &&t)
 flatten a named type without merging names
 
template<string_literal SEP = ".", typename T >
requires is_named_v<T>
constexpr auto merge_named_flatten (T &&t)
 flatten a named type with merging names
 
template<typename NAMED , size_t IDX = 0, typename PARTIAL = named<std::tuple<>>>
constexpr auto sort_named (NAMED &&named, PARTIAL &&partial=PARTIAL{})
 sort a named tuple by name using insert-sort.
 
template<typename NAMED , typename PROCESS , typename... Ts>
requires is_named_v<NAMED> && is_named_sorted_v<NAMED> && requires(PROCESS&& p) { p.template operator()<size_t(0)>(std::declval<std::string>(), std::declval<NAMED>(), std::declval<Ts>()...); }
auto binary_search_named (const std::string &str, NAMED &&named, PROCESS &&process, Ts &&... context)
 Run-time binary search for a matching name in a named tuple based on a string. The (index of the) found element is forwarded to a processing lambda.
 
template<typename NAMED , typename PROCESS , typename... Ts>
requires is_named_v<NAMED> && requires(PROCESS&& p) { p.template operator()<size_t(0)>(std::declval<std::string>(), std::declval<NAMED>(), std::declval<Ts>()...); }
auto linear_search_named (const std::string &str, NAMED &&named, PROCESS &&process, Ts &&... context)
 linear search for unsorted named tuples
 

Variables

template<typename NAMED >
static constexpr bool is_named_sorted_v = detail::is_named_sorted<NAMED>()
 true if named tuple is sorted by name
 
template<string_literal NAME, typename NAMED >
static constexpr size_t binary_search_named_v = detail::binary_search_named<NAME, std::decay_t<NAMED>>()
 binary search a sorted named tuple
 

Detailed Description

Additional convenience methods for named tuples.