KUMI v4.0.0
Flawless Fluorite
Loading...
Searching...
No Matches

◆ get_or()

template<std::size_t I, typename T, typename V>
decltype(auto) kumi::function::get_or ( T && t,
V && v )
inlinenodiscardconstexpr

#include <kumi/functional/monadic.hpp>

If T is a kumi::product_type, returns it's Ith element, returns an instance of V otherwise.

Note
Does not participate in overload resolution if I is not in [0, sizeof...(Ts)).
Template Parameters
ICompile-time index of the element to access
Parameters
ttype to inspect
vfallback value
Returns
A reference to the selected element of t if t is a kumi::product_type, the parameter v otherwise.