[Rcpp-commits] r527 - in pkg: . inst src src/Rcpp/internal
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Jan 31 12:46:05 CET 2010
Author: romain
Date: 2010-01-31 12:46:04 +0100 (Sun, 31 Jan 2010)
New Revision: 527
Modified:
pkg/NEWS
pkg/inst/ChangeLog
pkg/src/Rcpp/internal/wrap.h
pkg/src/RcppCommon.cpp
pkg/src/RcppCommon.h
Log:
+ wrap< tr1::unordered_set<T> >
Modified: pkg/NEWS
===================================================================
--- pkg/NEWS 2010-01-31 11:35:27 UTC (rev 526)
+++ pkg/NEWS 2010-01-31 11:46:04 UTC (rev 527)
@@ -1,16 +1,14 @@
0.7.5 (under development)
- o std::multiset<T> becomes wrap<>()'able
+ o wrap is now able to handle more stl types. Given that T can
+ be wrapped, the following can be wrapped:
+ - std::multiset<T>
+ - std::map<std::string,T>
+ - std::multimap<std::string,T>
+ - std::tr1::unordered_map<std::string,T>
+ - std::tr1::unordered_multimap<std::string,T>
- o std::map<std::string,T> becomes wrap<>()'able
-
- o std::multimap<std::string,T> becomes wrap<>()'able
-
- o std::tr1::unordered_map<std::string,T> becomes wrap<>()'able
-
- o std::tr1::unordered_multimap<std::string,T> becomes wrap<>()'able
-
0.7.4 2010-01-30
o matrix matrix-like indexing using operator() for all vector
Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog 2010-01-31 11:35:27 UTC (rev 526)
+++ pkg/inst/ChangeLog 2010-01-31 11:46:04 UTC (rev 527)
@@ -1,10 +1,13 @@
2010-01-31 Romain Francois <francoisromain at free.fr>
- * src/Rcpp/internal/wrap.h: more wrap for stl templates:
- multiset<T> where T can be wrap()'ed -> vector or list
- map<string,T> where T can be wrap()'ed -> named vector or named list
- multimap<string,T> where T can be wrap()'ed -> named vector or named list
- tr1::unordered_map<string,T> where T can be wrap()'ed -> named vector or named list
+ * src/Rcpp/internal/wrap.h: more wrap for stl templates are
+ candidate for wrap (when T can be wrapped)
+ multiset<T> -> vector or list
+ map<string,T> -> named vector or named list
+ multimap<string,T> -> named vector or named list
+ tr1::unordered_map<string,T> -> named vector or named list
+ tr1::unordered_set<T> -> vector or list
+ tr1::unordered_multiset<T> -> vector or list
2010-01-30 Dirk Eddelbuettel <edd at debian.org>
Modified: pkg/src/Rcpp/internal/wrap.h
===================================================================
--- pkg/src/Rcpp/internal/wrap.h 2010-01-31 11:35:27 UTC (rev 526)
+++ pkg/src/Rcpp/internal/wrap.h 2010-01-31 11:46:04 UTC (rev 527)
@@ -100,6 +100,10 @@
template <typename T> struct wrap_type_traits< std::tr1::unordered_map<std::string,T> > { typedef wrap_type_stl_container_tag category ; } ;
template <typename T> struct wrap_type_traits< std::tr1::unordered_multimap<std::string,T> > { typedef wrap_type_stl_container_tag category ; } ;
#endif
+#ifdef HAS_TR1_UNORDERED_SET
+template <typename T> struct wrap_type_traits< std::tr1::unordered_set<T> > { typedef wrap_type_stl_container_tag category ; } ;
+template <typename T> struct wrap_type_traits< std::tr1::unordered_multiset<T> > { typedef wrap_type_stl_container_tag category ; } ;
+#endif
// #ifdef HAS_INIT_LISTS
// template <typename T> struct wrap_type_traits< std::initializer_list<T> > { typedef wrap_type_stl_container_tag category ; } ;
Modified: pkg/src/RcppCommon.cpp
===================================================================
--- pkg/src/RcppCommon.cpp 2010-01-31 11:35:27 UTC (rev 526)
+++ pkg/src/RcppCommon.cpp 2010-01-31 11:46:04 UTC (rev 527)
@@ -42,8 +42,8 @@
}
SEXP capabilities(){
- SEXP cap = PROTECT( Rf_allocVector( LGLSXP, 4) ) ;
- SEXP names = PROTECT( Rf_allocVector( STRSXP, 4 ) ) ;
+ SEXP cap = PROTECT( Rf_allocVector( LGLSXP, 5) ) ;
+ SEXP names = PROTECT( Rf_allocVector( STRSXP, 5 ) ) ;
#ifdef HAS_VARIADIC_TEMPLATES
LOGICAL(cap)[0] = TRUE ;
#else
@@ -63,10 +63,17 @@
LOGICAL(cap)[3] = FALSE ;
#endif
+#ifdef HAS_TR1_UNORDERED_SET
+ LOGICAL(cap)[4] = TRUE ;
+#else
+ LOGICAL(cap)[4] = FALSE ;
+#endif
+
SET_STRING_ELT(names, 0, Rf_mkChar("variadic templates") ) ;
SET_STRING_ELT(names, 1, Rf_mkChar("initializer lists") ) ;
SET_STRING_ELT(names, 2, Rf_mkChar("exception handling") ) ;
SET_STRING_ELT(names, 3, Rf_mkChar("tr1 unordered maps") ) ;
+ SET_STRING_ELT(names, 4, Rf_mkChar("tr1 unordered sets") ) ;
Rf_setAttrib( cap, R_NamesSymbol, names ) ;
UNPROTECT(2) ;
return cap ;
Modified: pkg/src/RcppCommon.h
===================================================================
--- pkg/src/RcppCommon.h 2010-01-31 11:35:27 UTC (rev 526)
+++ pkg/src/RcppCommon.h 2010-01-31 11:46:04 UTC (rev 527)
@@ -38,6 +38,7 @@
// probably introduced before GCC 4.3
#if GCC_VERSION >= 40300
#define HAS_TR1_UNORDERED_MAP
+ #define HAS_TR1_UNORDERED_SET
#endif
#endif
@@ -63,6 +64,10 @@
#include <tr1/unordered_map>
#endif
+#ifdef HAS_TR1_UNORDERED_SET
+#include <tr1/unordered_set>
+#endif
+
// include R headers, but set R_NO_REMAP and access everything via Rf_ prefixes
#define R_NO_REMAP
#include <R.h>
More information about the Rcpp-commits
mailing list