Skip to content

Commit 6d1cafd

Browse files
committed
Fixing algorithm.h for icc
1 parent 88d10f5 commit 6d1cafd

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

inst/include/Rcpp/algorithm.h

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@
2323
#define Rcpp__Algorithm_h
2424

2525
#if __cplusplus >= 201103L || __INTEL_CXX11_MODE__ == 1
26-
# define RCPP_CONSTEXPR constexpr
26+
# define RCPP_CONSTEXPR_FUNC constexpr
27+
# define RCPP_CONSTEXPR_VAR constexpr
2728
#else
28-
# define RCPP_CONSTEXPR const
29+
# define RCPP_CONSTEXPR_FUNC
30+
# define RCPP_CONSTEXPR_VAR const
2931
#endif
3032

3133
namespace Rcpp {
@@ -160,41 +162,34 @@ namespace helpers {
160162

161163
template< typename T >
162164
struct rtype_helper {
163-
/*
164-
typedef T type;
165-
static RCPP_CONSTEXPR int RTYPE = REALSXP;
166-
static inline double NA() { return NA_REAL; }
167-
static inline RCPP_CONSTEXPR double ZERO() { return 0.0; }
168-
static inline RCPP_CONSTEXPR double ONE() { return 1.0; }
169-
*/
170165
};
171166

172167
template<>
173168
struct rtype_helper< double > {
174169
typedef double type;
175-
static RCPP_CONSTEXPR int RTYPE = REALSXP;
170+
static RCPP_CONSTEXPR_VAR int RTYPE = REALSXP;
176171
static inline double NA() { return NA_REAL; }
177-
static inline RCPP_CONSTEXPR double ZERO() { return 0.0; }
178-
static inline RCPP_CONSTEXPR double ONE() { return 1.0; }
172+
static inline RCPP_CONSTEXPR_FUNC double ZERO() { return 0.0; }
173+
static inline RCPP_CONSTEXPR_FUNC double ONE() { return 1.0; }
179174
};
180175

181176
template<>
182177
struct rtype_helper< int > {
183178
typedef int type;
184-
static RCPP_CONSTEXPR int RTYPE = INTSXP;
179+
static RCPP_CONSTEXPR_VAR int RTYPE = INTSXP;
185180
static inline int NA() { return NA_INTEGER; }
186-
static inline RCPP_CONSTEXPR int ZERO() { return 0; }
187-
static inline RCPP_CONSTEXPR int ONE() { return 1; }
181+
static inline RCPP_CONSTEXPR_FUNC int ZERO() { return 0; }
182+
static inline RCPP_CONSTEXPR_FUNC int ONE() { return 1; }
188183
};
189184

190185
template< typename T >
191186
struct rtype {
192187
typedef typename rtype_helper< typename ctype< T >::type >::type type;
193188
typedef rtype_helper< typename ctype< T >::type > helper_type;
194-
static RCPP_CONSTEXPR int RTYPE = helper_type::RTYPE;
189+
static RCPP_CONSTEXPR_VAR int RTYPE = helper_type::RTYPE;
195190
static inline T NA() { return helper_type::NA(); }
196-
static inline RCPP_CONSTEXPR T ZERO() { return helper_type::ZERO(); }
197-
static inline RCPP_CONSTEXPR T ONE() { return helper_type::ONE(); }
191+
static inline RCPP_CONSTEXPR_FUNC T ZERO() { return helper_type::ZERO(); }
192+
static inline RCPP_CONSTEXPR_FUNC T ONE() { return helper_type::ONE(); }
198193
};
199194

200195
struct log {
@@ -488,6 +483,7 @@ void sqrt(InputIterator begin, InputIterator end, OutputIterator out) {
488483
} // namespace algorithm
489484
} // namespace Rcpp
490485

491-
#undef RCPP_CONSTEXPR
486+
#undef RCPP_CONSTEXPR_FUNC
487+
#undef RCPP_CONSTEXPR_VAR
492488

493489
#endif

0 commit comments

Comments
 (0)