22//
33// traits.h: Rcpp R/C++ interface class library -- support traits for vector
44//
5- // Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois
5+ // Copyright (C) 2010 - 2015 Dirk Eddelbuettel and Romain Francois
66//
77// This file is part of Rcpp.
88//
2525namespace Rcpp {
2626namespace traits {
2727
28- template <int RTYPE >
28+ template <int RTYPE , template < class > class StoragePolicy = PreserveStorage >
2929 class r_vector_cache {
3030 public:
31- typedef typename ::Rcpp::Vector<RTYPE > VECTOR ;
31+ typedef typename ::Rcpp::Vector<RTYPE , StoragePolicy > VECTOR ;
3232 typedef typename r_vector_iterator<RTYPE >::type iterator ;
3333 typedef typename r_vector_const_iterator<RTYPE >::type const_iterator ;
3434 typedef typename r_vector_proxy<RTYPE >::type proxy ;
@@ -51,9 +51,10 @@ namespace traits{
5151 private:
5252 iterator start ;
5353 } ;
54- template <int RTYPE > class proxy_cache {
54+ template <int RTYPE , template <class > class StoragePolicy = PreserveStorage>
55+ class proxy_cache {
5556 public:
56- typedef typename ::Rcpp::Vector<RTYPE > VECTOR ;
57+ typedef typename ::Rcpp::Vector<RTYPE , StoragePolicy > VECTOR ;
5758 typedef typename r_vector_iterator<RTYPE >::type iterator ;
5859 typedef typename r_vector_const_iterator<RTYPE >::type const_iterator ;
5960 typedef typename r_vector_proxy<RTYPE >::type proxy ;
@@ -79,12 +80,24 @@ namespace traits{
7980 } ;
8081
8182 // regular types for INTSXP, REALSXP, ...
82- template <int RTYPE > struct r_vector_cache_type { typedef r_vector_cache<RTYPE > type ; } ;
83+ template <int RTYPE , template <class > class StoragePolicy = PreserveStorage>
84+ struct r_vector_cache_type {
85+ typedef r_vector_cache<RTYPE , StoragePolicy> type ;
86+ } ;
8387
8488 // proxy types for VECSXP, STRSXP and EXPRSXP
85- template <> struct r_vector_cache_type <VECSXP > { typedef proxy_cache<VECSXP > type ; } ;
86- template <> struct r_vector_cache_type <EXPRSXP > { typedef proxy_cache<EXPRSXP > type ; } ;
87- template <> struct r_vector_cache_type <STRSXP > { typedef proxy_cache<STRSXP > type ; } ;
89+ template <template <class > class StoragePolicy >
90+ struct r_vector_cache_type <VECSXP , StoragePolicy> {
91+ typedef proxy_cache<VECSXP , StoragePolicy> type ;
92+ } ;
93+ template <template <class > class StoragePolicy >
94+ struct r_vector_cache_type <EXPRSXP , StoragePolicy> {
95+ typedef proxy_cache<EXPRSXP , StoragePolicy> type ;
96+ } ;
97+ template <template <class > class StoragePolicy >
98+ struct r_vector_cache_type <STRSXP , StoragePolicy> {
99+ typedef proxy_cache<STRSXP , StoragePolicy> type ;
100+ } ;
88101
89102} // traits
90103}
0 commit comments