Skip to content

Commit 127f14d

Browse files
authored
Merge pull request #585 from dcdillon/feature/no-sugar-tonight-in-my-coffee
Feature/no sugar tonight in my coffee
2 parents c47efce + 37e6692 commit 127f14d

File tree

6 files changed

+50
-6
lines changed

6 files changed

+50
-6
lines changed

ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
2016-11-13 Daniel C. Dillon <[email protected]>
2+
* inst/include/Rcpp/RNGScope.h: Moved definition of RNGScope
3+
to its own file
4+
* inst/include/Rcpp.h: Unconditionally included RNGScope.h
5+
* inst/include/Rcpp/stats/random/random.h: Removed definition
6+
of RNGScope
7+
* inst/include/Rcpp/vector/Matrix.h: Protected Matrix op Scalar
8+
definitions with #ifndef RCPP_NO_SUGAR
9+
110
2016-11-10 Dirk Eddelbuettel <[email protected]>
211

312
* inst/include/Rcpp/date_datetime/newDateVector.h: Added constructor

inst/NEWS.Rd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
fixing \ghit{549})
2121
\item \code{Range} Sugar now used \code{R_xlen_t} type for start/end
2222
(PR \ghpr{568} by Qiang Kou)
23+
\item Defining \code{RCPP_NO_SUGAR} no longer breaks the build.
24+
(PR \ghpr{585} by Daniel C. Dillon)
2325
}
2426
\item Changes in Rcpp unit tests
2527
\itemize{

inst/include/Rcpp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@
6666

6767
#include <Rcpp/Nullable.h>
6868

69+
#include <Rcpp/RNGScope.h>
70+
6971
#ifndef RCPP_NO_SUGAR
7072
#include <Rcpp/sugar/sugar.h>
7173
#include <Rcpp/stats/stats.h>

inst/include/Rcpp/RNGScope.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2+
//
3+
// RNGScope.h: Rcpp R/C++ interface class library --
4+
//
5+
// Copyright (C) 2010 - 2016 Douglas Bates, Dirk Eddelbuettel and Romain Francois
6+
//
7+
// This file is part of Rcpp.
8+
//
9+
// Rcpp is free software: you can redistribute it and/or modify it
10+
// under the terms of the GNU General Public License as published by
11+
// the Free Software Foundation, either version 2 of the License, or
12+
// (at your option) any later version.
13+
//
14+
// Rcpp is distributed in the hope that it will be useful, but
15+
// WITHOUT ANY WARRANTY; without even the implied warranty of
16+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
// GNU General Public License for more details.
18+
//
19+
// You should have received a copy of the GNU General Public License
20+
// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
21+
22+
#ifndef Rcpp__RNGScope_h
23+
#define Rcpp__RNGScope_h
24+
25+
namespace Rcpp {
26+
27+
class RNGScope{
28+
public:
29+
RNGScope(){ internal::enterRNGScope(); }
30+
~RNGScope(){ internal::exitRNGScope(); }
31+
};
32+
33+
} // namespace Rcpp
34+
35+
#endif

inst/include/Rcpp/stats/random/random.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@
2424

2525
namespace Rcpp{
2626

27-
class RNGScope{
28-
public:
29-
RNGScope(){ internal::enterRNGScope(); }
30-
~RNGScope(){ internal::exitRNGScope(); }
31-
};
32-
3327
template <typename T>
3428
class Generator : public RNGScope {
3529
public:

inst/include/Rcpp/vector/Matrix.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ inline std::ostream &operator<<(std::ostream & s, const Matrix<REALSXP, StorageP
247247
return s;
248248
}
249249

250+
#ifndef RCPP_NO_SUGAR
250251
#define RCPP_GENERATE_MATRIX_SCALAR_OPERATOR(__OPERATOR__) \
251252
template <int RTYPE, template <class> class StoragePolicy, typename T > \
252253
inline typename traits::enable_if< traits::is_convertible< typename traits::remove_const_and_reference< T >::type, \
@@ -281,6 +282,7 @@ RCPP_GENERATE_SCALAR_MATRIX_OPERATOR(*)
281282
RCPP_GENERATE_SCALAR_MATRIX_OPERATOR(/)
282283

283284
#undef RCPP_GENERATE_SCALAR_MATRIX_OPERATOR
285+
#endif
284286

285287
template<template <class> class StoragePolicy >
286288
inline std::ostream &operator<<(std::ostream & s, const Matrix<INTSXP, StoragePolicy> & rhs) {

0 commit comments

Comments
 (0)