[Rcpp-commits] r1010 - pkg/Rcpp/inst/include/Rcpp/traits
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Apr 6 12:21:09 CEST 2010
Author: romain
Date: 2010-04-06 12:21:07 +0200 (Tue, 06 Apr 2010)
New Revision: 1010
Modified:
pkg/Rcpp/inst/include/Rcpp/traits/r_sexptype_traits.h
pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h
pkg/Rcpp/inst/include/Rcpp/traits/wrap_type_traits.h
Log:
support for containers of 'long double'
Modified: pkg/Rcpp/inst/include/Rcpp/traits/r_sexptype_traits.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/traits/r_sexptype_traits.h 2010-04-06 10:10:23 UTC (rev 1009)
+++ pkg/Rcpp/inst/include/Rcpp/traits/r_sexptype_traits.h 2010-04-06 10:21:07 UTC (rev 1010)
@@ -45,6 +45,11 @@
to be preserved than int */
template<> struct r_sexptype_traits<long>{ enum{ rtype = REALSXP } ; } ;
+/* long double are represented as numeric vectors because we cannot do better in R
+ some precision will be lost though
+*/
+template<> struct r_sexptype_traits<long double>{ enum{ rtype = REALSXP } ; } ;
+
/**
* Indicates if a primitive type needs a static_cast
*/
Modified: pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h 2010-04-06 10:10:23 UTC (rev 1009)
+++ pkg/Rcpp/inst/include/Rcpp/traits/r_type_traits.h 2010-04-06 10:21:07 UTC (rev 1010)
@@ -95,6 +95,10 @@
template<> struct r_type_traits<long>{ typedef r_type_primitive_tag r_category ; } ;
template<> struct r_type_traits< std::pair<const std::string,long> >{ typedef r_type_primitive_tag r_category ; } ;
+/* long */
+template<> struct r_type_traits<long double>{ typedef r_type_primitive_tag r_category ; } ;
+template<> struct r_type_traits< std::pair<const std::string,long double> >{ typedef r_type_primitive_tag r_category ; } ;
+
} // traits
} // Rcpp
Modified: pkg/Rcpp/inst/include/Rcpp/traits/wrap_type_traits.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/traits/wrap_type_traits.h 2010-04-06 10:10:23 UTC (rev 1009)
+++ pkg/Rcpp/inst/include/Rcpp/traits/wrap_type_traits.h 2010-04-06 10:21:07 UTC (rev 1010)
@@ -65,6 +65,8 @@
template <> struct wrap_type_traits<long> { typedef wrap_type_primitive_tag wrap_category; } ;
+template <> struct wrap_type_traits<long double> { typedef wrap_type_primitive_tag wrap_category; } ;
+
} // namespace traits
} // namespace Rcpp
#endif
More information about the Rcpp-commits
mailing list