Skip to content

Commit 3d5e62f

Browse files
committed
Tweaks
1 parent 72f4db1 commit 3d5e62f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

inst/include/Rcpp/vector/no_init.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,12 @@ class no_init_vector {
3535
return size;
3636
}
3737

38-
template <int RTYPE>
39-
operator Vector<RTYPE, PreserveStorage>() const {
38+
template <int RTYPE, template <class> class StoragePolicy >
39+
operator Vector<RTYPE, StoragePolicy>() const {
4040
// Explicitly protect temporary vector to avoid false positive
4141
// with rchk (#892)
42-
SEXP x = PROTECT(Rf_allocVector(RTYPE, size));
42+
Shield<SEXP> x(Rf_allocVector(RTYPE, size));
4343
Vector<RTYPE, PreserveStorage> ret(x);
44-
UNPROTECT(1);
4544
return ret;
4645
}
4746

0 commit comments

Comments
 (0)