Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
msupernaw committed Nov 12, 2023
1 parent f67dad8 commit 622bb1f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ setMethod("[", c(x = "Rcpp_SharedVector", i = "numeric"),
return(x$get(i))
})

setMethod("[<-", c(x = "Rcpp_SharedVector", i = "numeric", y = "numeric"),
function(x, i, y) {
(x$set(i,y))
})
# setMethod("[<-", c(x = "Rcpp_SharedVector", i = "numeric", y = "numeric"),
# function(x, i, y) {
# (x$set(i,y))
# })



10 changes: 10 additions & 0 deletions inst/include/ProcessR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ class SharedVector {
* @brief Copy constructor.
*/
SharedVector(const SharedVector& other) {
std::stringstream ss;

std::time_t t = std::time(0);
ss<<"REALSMVector_"<<t;
this->init(ss.str().c_str());
this->vec_m->resize(other.size());
for (size_t i = 0; i < this->vec_m->size(); i++) {
this->vec_m->at(i) = other.vec_m->at(i);
Expand All @@ -105,6 +110,11 @@ class SharedVector {
* @brief Initialization constructor with std::vector type..
*/
SharedVector(const std::vector<double>& other) {
std::stringstream ss;

std::time_t t = std::time(0);
ss<<"REALSMVector_"<<t;
this->init(ss.str().c_str());
this->vec_m->resize(other.size());
for (size_t i = 0; i < this->vec_m->size(); i++) {
this->vec_m->at(i) = other.at(i);
Expand Down

0 comments on commit 622bb1f

Please sign in to comment.