[Rcpp-commits] r3565 - in pkg/Rcpp: . inst/include/Rcpp/traits inst/include/Rcpp/vector
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Apr 7 15:17:13 CEST 2012
Author: romain
Date: 2012-04-07 15:17:12 +0200 (Sat, 07 Apr 2012)
New Revision: 3565
Modified:
pkg/Rcpp/ChangeLog
pkg/Rcpp/inst/include/Rcpp/traits/named_object.h
pkg/Rcpp/inst/include/Rcpp/vector/Vector.h
Log:
fixed the List::create bug
Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog 2012-04-04 19:05:53 UTC (rev 3564)
+++ pkg/Rcpp/ChangeLog 2012-04-07 13:17:12 UTC (rev 3565)
@@ -1,3 +1,9 @@
+
+2012-04-07 Romain Francois <romain at r-enthusiasts.com>
+
+ * inst/include/Rcpp/vector/Vector.h: bug fix. reported on Rcpp-devel
+ http://comments.gmane.org/gmane.comp.lang.r.rcpp/3292
+
2012-03-29 Dirk Eddelbuettel <edd at debian.org>
* inst/unitTests/runit.Vector.R: unit test for containsElementNamed
Modified: pkg/Rcpp/inst/include/Rcpp/traits/named_object.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/traits/named_object.h 2012-04-04 19:05:53 UTC (rev 3564)
+++ pkg/Rcpp/inst/include/Rcpp/traits/named_object.h 2012-04-07 13:17:12 UTC (rev 3565)
@@ -3,7 +3,7 @@
//
// has_iterator.h: Rcpp R/C++ interface class library -- identify if a class has a nested iterator typedef
//
-// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
+// Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois
//
// This file is part of Rcpp.
//
@@ -28,13 +28,31 @@
namespace traits{
+template <typename T> struct needs_protection : false_type{} ;
+template <> struct needs_protection<SEXP> : true_type{} ;
+
template <typename T> class named_object {
public:
named_object( const std::string& name_, const T& o_) :
- name(name_), object(o_){}
+ name(name_), object(o_){}
const std::string& name ;
const T& object ;
+
} ;
+template <> class named_object<SEXP> {
+public:
+ named_object( const std::string& name_, const SEXP& o_):
+ name(name_), object(o_){
+ R_PreserveObject(object) ;
+ }
+ ~named_object(){
+ R_ReleaseObject(object) ;
+ }
+ const std::string& name ;
+ SEXP object ;
+} ;
+
+
template <typename T> struct is_named : public false_type{} ;
template <typename T> struct is_named< named_object<T> > : public true_type {} ;
template <> struct is_named< Rcpp::Argument > : public true_type {} ;
Modified: pkg/Rcpp/inst/include/Rcpp/vector/Vector.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/vector/Vector.h 2012-04-04 19:05:53 UTC (rev 3564)
+++ pkg/Rcpp/inst/include/Rcpp/vector/Vector.h 2012-04-07 13:17:12 UTC (rev 3565)
@@ -47,7 +47,7 @@
};
Vector( const Vector& other) : RObject() {
- RObject::setSEXP(other.asSexp()) ;
+ set_sexp( other.asSexp() ) ;
}
Vector& operator=( const Vector& other ){
More information about the Rcpp-commits
mailing list