Skip to content

Commit 559de61

Browse files
committed
Manual merge of branch 'origin/feature/new-env' (#169)
2 parents 0941aaf + 7545340 commit 559de61

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

ChangeLog

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2014-09-03 Kevin Ushey <[email protected]>
2+
3+
* inst/include/Rcpp/Environment.h: make new_env a free function
4+
15
2014-09-02 Kevin Ushey <[email protected]>
26

37
* inst/include/Rcpp/api/meat/proxy.h: Finish meat reintroduction + tests
@@ -20,6 +24,10 @@
2024
* inst/include/Rcpp/vector/ListOf.h: `size()` member function should
2125
return `R_len_t` rather than `int`
2226

27+
2014-08-30 Kevin Ushey <[email protected]>
28+
29+
* inst/include/Rcpp/Environment.h: Add 'new_env' function
30+
2331
2014-08-30 Dirk Eddelbuettel <[email protected]>
2432

2533
* inst/include/Rcpp/vector/Vector.h: Mark two 'from string' ctors as

inst/include/Rcpp/Environment.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
#ifndef Rcpp_Environment_h
2323
#define Rcpp_Environment_h
2424

25+
// From 'R/Defn.h'
26+
// NOTE: can't include header directly as it checks for some C99 features
27+
extern "C" SEXP R_NewHashedEnv(SEXP, SEXP);
28+
2529
namespace Rcpp{
2630

2731
RCPP_API_CLASS(Environment_Impl),
@@ -349,7 +353,12 @@ namespace Rcpp{
349353
void update(SEXP){}
350354
};
351355

352-
typedef Environment_Impl<PreserveStorage> Environment ;
356+
typedef Environment_Impl<PreserveStorage> Environment ;
357+
358+
inline Environment new_env(int size = 29) {
359+
Shield<SEXP> sizeSEXP(Rf_ScalarInteger(size));
360+
return R_NewHashedEnv(R_EmptyEnv, sizeSEXP);
361+
};
353362

354363

355364
} // namespace Rcpp

0 commit comments

Comments
 (0)