arg_router  1.4.0
C++ command line argument parsing and routing
arg_router::algorithm Namespace Reference

Classes

class  find_specialisation
 
class  count_specialisation
 
class  count_despecialised
 
struct  has_specialisation
 
class  zip
 
struct  unzip
 

Typedefs

template<typename First , typename Second >
using zip_t = typename zip< First, Second >::type
 

Functions

template<template< typename... > typename Fn, typename U >
constexpr auto tuple_filter_and_construct (U &&input) noexcept
 
template<typename Tuple , typename Insert >
constexpr auto tuple_push_back (Tuple tuple, Insert insert) noexcept
 
template<std::size_t Count, typename Tuple >
constexpr auto tuple_drop (Tuple &&input)
 
template<std::size_t I, typename... T>
constexpr auto & pack_element (const T &... pack) noexcept
 

Variables

template<template< typename... > typename T, typename Tuple >
constexpr auto find_specialisation_v = find_specialisation<T, Tuple>::value
 
template<template< typename... > typename T, typename Tuple >
constexpr auto count_specialisation_v = count_specialisation<T, Tuple>::value
 
template<typename T , typename Tuple >
constexpr auto count_despecialised_v = count_despecialised<T, Tuple>::value
 
template<template< typename... > typename T, typename Tuple >
constexpr auto has_specialisation_v = has_specialisation<T, Tuple>::value
 

Detailed Description

Namespace for generic algorithms.

Typedef Documentation

◆ zip_t

template<typename First , typename Second >
using arg_router::algorithm::zip_t = typedef typename zip<First, Second>::type

Helper alias for zip.

Template Parameters
FirstFirst tuple
SecondSecond tuple

Definition at line 158 of file algorithm.hpp.

Function Documentation

◆ pack_element()

template<std::size_t I, typename... T>
constexpr auto& arg_router::algorithm::pack_element ( const T &...  pack)
constexprnoexcept

Convenience function for accessing a reference to the pack element at index I.

Compilation failure if I is greater than or equal to the number of elements in pack.

Template Parameters
IIndex of pack element to access
TPack types
Parameters
packParameter pack
Returns
Const reference to the pack element at index I

Definition at line 288 of file algorithm.hpp.

◆ tuple_drop()

template<std::size_t Count, typename Tuple >
constexpr auto arg_router::algorithm::tuple_drop ( Tuple &&  input)
constexpr

Remove the first Count elements from tuple.

Parameters
inputTuple to remove elements from
Returns
Tuple with the first Count elements removed

Definition at line 272 of file algorithm.hpp.

◆ tuple_filter_and_construct()

template<template< typename... > typename Fn, typename U >
constexpr auto arg_router::algorithm::tuple_filter_and_construct ( U &&  input)
constexprnoexcept

Moves (or copies if unable to) elements from input if their type passes Fn, and constructs a tuple instance from them.

The key point of this function is that this operation is done in a single expression so it works with tuples with elements that are not default constructible.

Template Parameters
FnMetafunction type whose value member is true for types in U wanted in the return
UTuple-like input type
Parameters
inputTuple-like input
Returns
Result tuple

Definition at line 196 of file algorithm.hpp.

◆ tuple_push_back()

template<typename Tuple , typename Insert >
constexpr auto arg_router::algorithm::tuple_push_back ( Tuple  tuple,
Insert  insert 
)
constexprnoexcept

Appends insert to tuple.

Template Parameters
TupleA tuple-like type
InsertThe type to append
Parameters
tupleTuple instance
insertInstance to append
Returns
A Tuple with insert appended

Definition at line 246 of file algorithm.hpp.

Variable Documentation

◆ count_despecialised_v

template<typename T , typename Tuple >
constexpr auto arg_router::algorithm::count_despecialised_v = count_despecialised<T, Tuple>::value
constexpr

Helper variable for count_despecialised.

Template Parameters
TType to search for
TupleTypes to search (may be empty)

Definition at line 100 of file algorithm.hpp.

◆ count_specialisation_v

template<template< typename... > typename T, typename Tuple >
constexpr auto arg_router::algorithm::count_specialisation_v = count_specialisation<T, Tuple>::value
constexpr

Helper variable for count_specialisation.

Template Parameters
TSpecialisation to search for
TupleTypes to search (may be empty)

Definition at line 76 of file algorithm.hpp.

◆ find_specialisation_v

template<template< typename... > typename T, typename Tuple >
constexpr auto arg_router::algorithm::find_specialisation_v = find_specialisation<T, Tuple>::value
constexpr

Helper variable for find_specialisation.

Template Parameters
TSpecialisation to search for
TupleTypes to search (may be empty)

Definition at line 46 of file algorithm.hpp.

◆ has_specialisation_v

template<template< typename... > typename T, typename Tuple >
constexpr auto arg_router::algorithm::has_specialisation_v = has_specialisation<T, Tuple>::value
constexpr

Helper variable for has_specialisation.

Template Parameters
TSpecialisation to search for
TupleTypes to search (may be empty)

Definition at line 124 of file algorithm.hpp.