24 #ifndef ARM_COMPUTE_TEST_UTILS
25 #define ARM_COMPUTE_TEST_UTILS
37 #include <type_traits>
53 template <
int N,
int... Ns>
54 struct sequence_generator;
57 struct sequence_generator<0, Ns...>
59 using type = sequence<Ns...>;
62 template <
int N,
int... Ns>
63 struct sequence_generator : sequence_generator < N - 1, N - 1, Ns... >
71 template <
typename O,
typename F,
typename... As,
int... S>
72 void apply_impl(O *obj, F &&func,
const std::tuple<As...> &
args, detail::sequence<S...>)
74 (obj->*func)(std::get<S>(
args)...);
78 template <
typename O,
typename F,
typename... As>
79 void apply(O *obj, F &&func,
const std::tuple<As...> &
args)
92 template <typename T, typename std::enable_if<std::is_same<typename T::value_type, std::string>::value,
int>
::type = 0>
93 std::string
join(T first, T last,
const std::string &separator)
95 return std::accumulate(std::next(first), last, *first, [&separator](
const std::string & base,
const std::string & suffix)
97 return base + separator + suffix;
116 template <
typename T,
typename UnaryOp>
117 std::string
join(T &&first, T &&last,
const std::string &separator, UnaryOp &&op)
119 return std::accumulate(std::next(first), last, op(*first), [&separator, &op](
const std::string & base,
const typename T::value_type & suffix)
121 return base + separator + op(suffix);
135 template <typename T, typename std::enable_if<std::is_arithmetic<typename T::value_type>::value,
int>
::type = 0>
136 std::string
join(T && first, T && last,
const std::string &separator)
147 inline std::string
tolower(std::string
string)
149 std::transform(
string.begin(),
string.
end(),
string.begin(), [](
unsigned char c)
163 template <typename T, typename std::enable_if<std::is_arithmetic<T>::value,
int>
::type = 0>
166 std::stringstream
ss;
168 ss.precision((decimal_places) ? decimal_places : std::numeric_limits<T>::digits10 + 1);