7 #if !defined(CNL_IMPL_WRAPPER_OPERATOR_HELPERS_H)
8 #define CNL_IMPL_WRAPPER_OPERATOR_HELPERS_H
10 #include "../custom_operator/definition.h"
11 #include "is_wrapper.h"
15 #include <type_traits>
23 template<_impl::any_wrapper Number>
24 inline constexpr
auto wants_generic_ops<Number> =
true;
29 template<class Number, bool IsComposite = is_composite<Number>::value>
30 struct composition_depth;
32 template<
class Number>
33 struct composition_depth<Number, true> {
35 using rep = _impl::rep_of_t<Number>;
38 static constexpr
auto value = composition_depth<rep>::value + 1;
48 template<
typename Wrapper>
49 inline constexpr
auto can_be_number_wrapper = is_wrapper<Wrapper>;
51 template<
typename Wrapper,
int WrapperN>
53 inline constexpr
auto can_be_number_wrapper<Wrapper[WrapperN]> =
false;
58 template<
typename Rep>
59 struct can_be_wrapped_by_number
61 bool, std::numeric_limits<Rep>::is_specialized
62 && !std::is_floating_point<Rep>::value> {
65 template<
typename Rep,
int RepN>
73 template<
typename T1,
typename T2>
74 struct is_same_number_wrapper
76 bool, std::is_same<from_value_t<T1, int>, from_value_t<T2, int>>::value> {
82 template<
typename Wrapper,
typename Rep>
83 struct number_can_wrap
85 bool, can_be_wrapped_by_number<Rep>::value
86 && can_be_number_wrapper<Wrapper> && !is_same_number_wrapper<Wrapper, Rep>::value
87 && (composition_depth<Rep>::value < composition_depth<Wrapper>::value)> {