Skip to content

Commit befd103

Browse files
committed
Added is_integral_list type trait that checks that all types in a parameter pack are integral types.
1 parent bb35243 commit befd103

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/TiledArray/type_traits.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,23 @@ namespace TiledArray {
129129
public scalar_type<PlainObjectType>
130130
{ };
131131

132+
template <typename...> struct is_integral_list_helper;
133+
134+
template <typename T, typename...Ts>
135+
struct is_integral_list_helper<T, Ts...> {
136+
static constexpr bool value = std::is_integral<T>::value && is_integral_list_helper<Ts...>::value;
137+
};
138+
139+
template <> struct is_integral_list_helper<> { static constexpr bool value = true; };
140+
141+
///
142+
template <typename...Ts>
143+
struct is_integral_list : std::conditional<(sizeof...(Ts) > 0ul),
144+
is_integral_list_helper<Ts...>,
145+
std::false_type>::type
146+
{ };
147+
148+
132149
/// Describes traits of nodes in TiledArray expressions
133150
template <typename T, typename Enabler = void>
134151
struct eval_trait {

0 commit comments

Comments
 (0)