File tree Expand file tree Collapse file tree 2 files changed +2
-19
lines changed
inst/include/Rcpp/internal Expand file tree Collapse file tree 2 files changed +2
-19
lines changed Original file line number Diff line number Diff line change 112026-03-26 Iñaki Ucar <iucar@fedoraproject.org>
22
3- * inst/include/Rcpp/internal/r_vector.h: Return null start for empty vectors
4- instead of an invalid pointer , which causes UB in e.g. std::copy
3+ * inst/include/Rcpp/internal/r_vector.h: Use dataptr() again to avoid an
4+ invalid pointer for empty vectors , which causes UB in e.g. std::copy
55 * inst/tinytest/test_vector.R: Add tests for std::copy
66 * inst/tinytest/cpp/Vector.cpp: Idem
77
Original file line number Diff line number Diff line change @@ -33,23 +33,6 @@ typename Rcpp::traits::storage_type<RTYPE>::type* r_vector_start(SEXP x) {
3333 return reinterpret_cast <pointer>(dataptr (x));
3434}
3535
36- // add specializations to avoid use of dataptr
37- #define RCPP_VECTOR_START_IMPL (__RTYPE__, __ACCESSOR__ ) \
38- template <> \
39- inline typename Rcpp::traits::storage_type<__RTYPE__>::type* r_vector_start<__RTYPE__>(SEXP x) { \
40- if (Rf_xlength (x) == 0 ) \
41- return NULL ; \
42- return __ACCESSOR__ (x); \
43- }
44-
45- RCPP_VECTOR_START_IMPL (LGLSXP, LOGICAL);
46- RCPP_VECTOR_START_IMPL (INTSXP, INTEGER);
47- RCPP_VECTOR_START_IMPL (RAWSXP, RAW);
48- RCPP_VECTOR_START_IMPL (CPLXSXP, COMPLEX);
49- RCPP_VECTOR_START_IMPL (REALSXP, REAL);
50-
51- #undef RCPP_VECTOR_START_IMPL
52-
5336/* *
5437 * The value 0 statically casted to the appropriate type for
5538 * the given SEXP type
You can’t perform that action at this time.
0 commit comments