Skip to content

Commit 07e045e

Browse files
committed
be defensive about sample.h w.r.t RcppArmadillo
1 parent 39edf69 commit 07e045e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2016-12-12 Dirk Eddelbuettel <[email protected]>
2+
3+
* inst/include/Rcpp/sugar/functions/sample.h: In case sample.h from the
4+
RcppArmadillo extensions was included, skip this file
5+
16
2016-12-10 Nathan Russell <[email protected]>
27

38
* inst/include/Rcpp/sugar/functions/sample.h: New function

inst/include/Rcpp/sugar/functions/sample.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
// You should have received a copy of the GNU General Public License
2020
// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
2121

22+
// The sample() in RcppArmadillo came first, but is opt-in. In case someone did
23+
// in fact load it, we need to skip the declarations here to avoid a conflict
24+
#ifndef RCPPARMADILLO__EXTENSIONS__SAMPLE_H
25+
2226
#ifndef Rcpp__sugar__sample_h
2327
#define Rcpp__sugar__sample_h
2428

@@ -493,3 +497,4 @@ sample(const Vector<RTYPE>& x, int size, bool replace = false, sugar::probs_t pr
493497
} // Rcpp
494498

495499
#endif // Rcpp__sugar__sample_h
500+
#endif // RCPPARMADILLO__EXTENSIONS__SAMPLE_H

0 commit comments

Comments
 (0)