File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -419,8 +419,7 @@ namespace Rcpp {
419419 }
420420
421421 CppClass& operator =( const CppClass& other) {
422- Storage::copy__ ( static_cast <const S4 &>(other) ) ;
423- return *this ;
422+ return Storage::copy__ ( other ) ;
424423 }
425424
426425 } ;
@@ -433,8 +432,13 @@ namespace Rcpp {
433432 slot ( " cppclass" ) = Rcpp::XPtr<class_Base>( clazz, false ) ;
434433 slot ( " pointer" ) = xp ;
435434 }
436- CppObject ( const CppObject& ) ;
437- CppObject& operator =( const CppObject& ) ;
435+ CppObject ( const CppObject& other){
436+ Storage::copy ( other ) ;
437+ }
438+
439+ CppObject& operator =( const CppObject& other ) {
440+ return Storage::copy__ ( other ) ;
441+ }
438442
439443 } ;
440444
Original file line number Diff line number Diff line change @@ -32,11 +32,12 @@ namespace Rcpp{
3232 return out ;
3333 }
3434
35- inline CLASS & copy__ (const CLASS & other){
35+ template <typename T>
36+ inline T& copy__ (const T& other){
3637 if ( this != &other){
3738 set__ (other.get__ ());
3839 }
39- return static_cast <CLASS &>(*this ) ;
40+ return static_cast <T &>(*this ) ;
4041 }
4142
4243 inline bool inherits (const char * clazz) const {
Original file line number Diff line number Diff line change @@ -241,12 +241,6 @@ extern "C" void R_init_Rcpp( DllInfo* info){
241241
242242namespace Rcpp {
243243
244- CppObject::CppObject ( const CppObject& other) : S4 (other.asSexp()){}
245- CppObject& CppObject::operator =( const CppObject& other){
246- setSEXP ( other.asSexp () ) ;
247- return *this ;
248- }
249-
250244 namespace internal {
251245 void * as_module_object_internal (SEXP obj){
252246 Environment env (obj) ;
You can’t perform that action at this time.
0 commit comments