Skip to content

Commit 60b6485

Browse files
committed
refactored lazy subsetting
2 parents 763eac2 + 14750e6 commit 60b6485

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

inst/include/etr_bits/Core.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
// this is sorted by clang format be careful
55
#include "./Core/Header.hpp"
6+
#include "./Core/TemplateUtils.hpp"
67
#include "./Core/Utils.hpp"
78
#include "./Core/Reflection.hpp"
89
#include "./Core/Traits.hpp"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
#ifndef TEMPLATE_UTILS_ETR_H
3+
#define TEMPLATE_UTILS_ETR_H
4+
5+
#include "Header.hpp"
6+
#include <type_traits>
7+
8+
namespace etr {
9+
10+
template <typename T> using IsArith = std::is_arithmetic<T>;
11+
template <typename T> constexpr bool IsArithV = std::is_arithmetic_v<T>;
12+
13+
} // namespace etr
14+
15+
#endif

inst/include/etr_bits/Subsetting/LazySubsetting.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ template <typename L, typename R> struct SubsetClassIterator {
3333
: l(l), r(r), index(index) {}
3434

3535
auto operator*() const {
36-
constexpr bool isArithmeticR = std::is_arithmetic_v<R>;
36+
constexpr bool isArithmeticR = IsArithV<R>;
3737
if constexpr (isArithmeticR) {
3838
return l[r];
3939
} else if constexpr (!isArithmeticR) {

0 commit comments

Comments
 (0)