Skip to content

Commit a1aba17

Browse files
committed
Simplify altrep.hpp as much as possible
Likely still need to keep it around for compatibility reasons
1 parent b81cd3d commit a1aba17

File tree

2 files changed

+3
-40
lines changed

2 files changed

+3
-40
lines changed

inst/include/cpp11/R.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
// clang-format on
2828

2929
#include <type_traits>
30-
#include "cpp11/altrep.hpp"
3130

3231
#if defined(R_VERSION) && R_VERSION >= R_Version(4, 4, 0)
3332
// Use R's new macro

inst/include/cpp11/altrep.hpp

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,6 @@
11
#pragma once
22

3-
#include "Rversion.h"
4-
5-
#if defined(R_VERSION) && R_VERSION >= R_Version(3, 5, 0)
3+
// It would be nice to remove this since all supported versions of R have ALTREP, but
4+
// some groups rely on both this `#define` and `altrep.hpp` itself existing, like arrow:
5+
// https://github.com/apache/arrow/blob/50f2d6e04e8323119d4dd31506827ee398d6b8e4/r/src/altrep.cpp#L27-L29
66
#define HAS_ALTREP
7-
#endif
8-
9-
#ifndef HAS_ALTREP
10-
11-
#define ALTREP(x) false
12-
13-
#define REAL_ELT(x, i) REAL(x)[i]
14-
#define INTEGER_ELT(x, i) INTEGER(x)[i]
15-
#define LOGICAL_ELT(x, i) LOGICAL(x)[i]
16-
#define RAW_ELT(x, i) RAW(x)[i]
17-
18-
#define SET_REAL_ELT(x, i, val) REAL(x)[i] = val
19-
#define SET_INTEGER_ELT(x, i, val) INTEGER(x)[i] = val
20-
#define SET_LOGICAL_ELT(x, i, val) LOGICAL(x)[i] = val
21-
#define SET_RAW_ELT(x, i, val) RAW(x)[i] = val
22-
23-
#define REAL_GET_REGION(...) \
24-
do { \
25-
} while (false)
26-
27-
#define INTEGER_GET_REGION(...) \
28-
do { \
29-
} while (false)
30-
#endif
31-
32-
#if !defined HAS_ALTREP || (defined(R_VERSION) && R_VERSION < R_Version(3, 6, 0))
33-
34-
#define LOGICAL_GET_REGION(...) \
35-
do { \
36-
} while (false)
37-
38-
#define RAW_GET_REGION(...) \
39-
do { \
40-
} while (false)
41-
42-
#endif

0 commit comments

Comments
 (0)