namespace selector
Summary
Members | Descriptions |
---|---|
struct selector_func_traits<F> |
Selector function traits. |
struct type_chooser<bool, T> |
Trait that extracts the selector i/o type. |
public template<typename F1,typename F2,typename... Funcs> inline constexpr auto compose_selector(const F1 & f1,const F2 & f2,Funcs... fns) |
Recursive template for selector composition. |
public template<typename F,> inline constexpr auto selector_out_single_to_set(const F & f) |
Converts a selector with single output in one with set output |
public template<typename F> inline constexpr auto selector_in_single_to_set(const F & f) |
Converts a selector with single output in one with set output |
public template<typename F1,typename F2> inline constexpr auto selector_foreach(const F1 & f1,const F2 & f2) |
Creates a new selector that applies the selector f2 to each selected element of f1. |
public template<typename F1,typename F2,typename... Funcs> inline constexpr auto union_selector(const F1 & f1,const F2 & f2,Funcs... fns) |
Recursive template for selector union. |
public template<typename F1,typename F2,typename... Funcs> inline constexpr auto intersection_selector(const F1 & f1,const F2 & f2,Funcs... fns) |
Recursive template for selector intersection. |
public template<typename F1,typename F2> inline constexpr auto diff_selector_factory(const F1 & f_1,const F2 & f_2) |
Assymetric difference. |
Members
struct
type_chooser<bool,T>
Trait that extracts the selector i/o type. The first template parameter is a set indicator. If true, T is assumed to be an iterator
struct type_chooser {
using type = ...
};
struct
selector_func_traits<F>
Selector function traits. Extracts selector arity, input and output types
template <typename F> struct selector_func_traits {
using base_traits = neurostr::traits::function_traits<F>;
constexpr static bool in_set = (base_traits::arity > 1);
constexpr static bool out_set = (traits::is_vector<typename base_traits::result_type>::value);
using out_type = typename type_chooser<out_set, typename base_traits::result_type>::type;
using base_in_type = typename std::remove_reference_t<std::remove_const_t<typename base_traits::template arg<0>>>;
using in_type = typename type_chooser<in_set, base_in_type>::type;
};
public template<typename F1,typename F2,typename... Funcs>
inline constexpr auto compose_selector(const F1 & f1,const F2 & f2,Funcs... fns)
Recursive template for selector composition.
Parameters
-
f1
First function -
f2
Second function fns
Rest
Returns
f1 o f2 o rest
public template<typename F>
inline constexpr auto selector_out_single_to_set(const F & f)
Converts a selector with single output in one with set output.
public template<typename F>
inline constexpr auto selector_in_single_to_set(const F & f)
Converts a selector with single output in one with set output
public template<typename F1,typename F2>
inline constexpr auto selector_foreach(const F1 & f1,const F2 & f2)
Creates a new selector that applies the selector f2 to each selected element of f1.
Parameters
-
f1
First selector (that selects a set) f2
Second selector (input a single element)
public template<typename F1,typename F2,typename... Funcs>
inline constexpr auto union_selector(const F1 & f1,const F2 & f2,Funcs... fns)
Recursive template for selector union.
Base case.
Parameters
-
f1
First function f2
Second function
Returns
Join selector
public template<typename F1,typename F2,typename... Funcs>
inline constexpr auto intersection_selector(const F1 & f1,const F2 & f2,Funcs... fns)
Recursive template for selector intersection.
Base case.
Parameters
-
f1
First function f2
Second function
Returns
Intersection selector
public template<typename F1,typename F2>
inline constexpr auto diff_selector_factory(const F1 & f_1,const F2 & f_2)
Asymmetric difference.
Parameters
-
f_1
Base set f_2
Difference set
Returns
Difference selector
Prebuilt Selector Functions
Go to the prebuilt Selectors section