diff --git a/DESCRIPTION b/DESCRIPTION index f40a9a8bb..6dca7b8ea 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: Rcpp Title: Seamless R and C++ Integration -Version: 0.12.16.2 -Date: 2018-04-25 +Version: 0.12.16.3 +Date: 2018-05-04 Author: Dirk Eddelbuettel, Romain Francois, JJ Allaire, Kevin Ushey, Qiang Kou, Nathan Russell, Douglas Bates and John Chambers Maintainer: Dirk Eddelbuettel diff --git a/inst/include/Rcpp/String.h b/inst/include/Rcpp/String.h index 8e4528d49..dd771d0ef 100644 --- a/inst/include/Rcpp/String.h +++ b/inst/include/Rcpp/String.h @@ -2,7 +2,7 @@ // // String.h: Rcpp R/C++ interface class library -- single string // -// Copyright (C) 2012 - 2015 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2012 - 2018 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -483,8 +483,8 @@ namespace Rcpp { } namespace internal { - template - string_proxy& string_proxy::operator=(const String& s) { + template class StoragePolicy> + string_proxy& string_proxy::operator=(const String& s) { set(s.get_sexp()); return *this; } @@ -500,9 +500,9 @@ namespace Rcpp { return s.get_sexp(); } - template + template class StoragePolicy> template - string_proxy& string_proxy::operator+=(const T& rhs) { + string_proxy& string_proxy::operator+=(const T& rhs) { String tmp = get(); tmp += rhs; set(tmp); diff --git a/inst/include/Rcpp/internal/Proxy_Iterator.h b/inst/include/Rcpp/internal/Proxy_Iterator.h index 393d6debb..bc94f112b 100644 --- a/inst/include/Rcpp/internal/Proxy_Iterator.h +++ b/inst/include/Rcpp/internal/Proxy_Iterator.h @@ -81,7 +81,7 @@ class Proxy_Iterator { } inline reference operator*() { - return proxy ; + return proxy ; } inline pointer operator->(){ return &proxy ; diff --git a/inst/include/Rcpp/vector/00_forward_proxy.h b/inst/include/Rcpp/vector/00_forward_proxy.h index df623ef34..9098b51fa 100644 --- a/inst/include/Rcpp/vector/00_forward_proxy.h +++ b/inst/include/Rcpp/vector/00_forward_proxy.h @@ -2,7 +2,7 @@ // // 00_forward_proxy.h: Rcpp R/C++ interface class library -- proxies // -// Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2010 - 2018 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -25,25 +25,25 @@ namespace Rcpp{ namespace internal{ - template class string_proxy ; - template class const_string_proxy ; - template class generic_proxy ; - template class const_generic_proxy ; - template class simple_name_proxy ; - template class string_name_proxy ; - template class generic_name_proxy ; + template class StoragePolicy = PreserveStorage> class string_proxy ; + template class StoragePolicy = PreserveStorage> class const_string_proxy ; + template class StoragePolicy = PreserveStorage> class generic_proxy ; + template class StoragePolicy = PreserveStorage> class const_generic_proxy ; + template class StoragePolicy = PreserveStorage> class simple_name_proxy ; + template class StoragePolicy = PreserveStorage> class string_name_proxy ; + template class StoragePolicy = PreserveStorage> class generic_name_proxy ; } namespace traits { template class StoragePolicy> struct r_vector_cache_type ; template class StoragePolicy> class r_vector_cache ; - template struct r_vector_name_proxy ; - template struct r_vector_proxy ; - template struct r_vector_const_proxy ; + template class StoragePolicy = PreserveStorage> struct r_vector_name_proxy ; + template class StoragePolicy = PreserveStorage> struct r_vector_proxy ; + template class StoragePolicy = PreserveStorage> struct r_vector_const_proxy ; - template struct r_vector_iterator ; - template struct r_vector_const_iterator ; + template class StoragePolicy = PreserveStorage> struct r_vector_iterator ; + template class StoragePolicy = PreserveStorage> struct r_vector_const_iterator ; } } diff --git a/inst/include/Rcpp/vector/Vector.h b/inst/include/Rcpp/vector/Vector.h index 141bce006..0f893eaab 100644 --- a/inst/include/Rcpp/vector/Vector.h +++ b/inst/include/Rcpp/vector/Vector.h @@ -2,7 +2,7 @@ // // Vector.h: Rcpp R/C++ interface class library -- vectors // -// Copyright (C) 2010 - 2017 Dirk Eddelbuettel and Romain Francois +// Copyright (C) 2010 - 2018 Dirk Eddelbuettel and Romain Francois // // This file is part of Rcpp. // @@ -40,12 +40,12 @@ class Vector : typedef StoragePolicy Storage ; typename traits::r_vector_cache_type::type cache ; - typedef typename traits::r_vector_proxy::type Proxy ; - typedef typename traits::r_vector_const_proxy::type const_Proxy ; - typedef typename traits::r_vector_name_proxy::type NameProxy ; - typedef typename traits::r_vector_proxy::type value_type ; - typedef typename traits::r_vector_iterator::type iterator ; - typedef typename traits::r_vector_const_iterator::type const_iterator ; + typedef typename traits::r_vector_proxy::type Proxy ; + typedef typename traits::r_vector_const_proxy::type const_Proxy ; + typedef typename traits::r_vector_name_proxy::type NameProxy ; + typedef typename traits::r_vector_proxy::type value_type ; + typedef typename traits::r_vector_iterator::type iterator ; + typedef typename traits::r_vector_const_iterator::type const_iterator ; typedef typename traits::init_type::type init_type ; typedef typename traits::r_vector_element_converter::type converter_type ; typedef typename traits::storage_type::type stored_type ; @@ -936,6 +936,7 @@ class Vector : } R_xlen_t n = size() ; + Vector target( n - 1 ) ; iterator target_it(target.begin()) ; iterator it(begin()) ; diff --git a/inst/include/Rcpp/vector/const_generic_proxy.h b/inst/include/Rcpp/vector/const_generic_proxy.h index 88e8d99c9..ac1f53e4e 100644 --- a/inst/include/Rcpp/vector/const_generic_proxy.h +++ b/inst/include/Rcpp/vector/const_generic_proxy.h @@ -1,6 +1,6 @@ // const_generic_proxy.h: Rcpp R/C++ interface class library -- // -// Copyright (C) 2013 Romain Francois +// Copyright (C) 2013 - 2018 Romain Francois // // This file is part of Rcpp. // @@ -23,10 +23,10 @@ namespace Rcpp{ namespace internal{ - template - class const_generic_proxy : public GenericProxy< const_generic_proxy > { + template class StoragePolicy> + class const_generic_proxy : public GenericProxy< const_generic_proxy > { public: - typedef typename ::Rcpp::Vector VECTOR ; + typedef typename ::Rcpp::Vector VECTOR ; const_generic_proxy(): parent(0), index(-1){} @@ -48,7 +48,7 @@ namespace internal{ operator int() const { return ::Rcpp::as(get()) ; } inline void move(R_xlen_t n) { index += n ; } - + const VECTOR* parent; R_xlen_t index ; diff --git a/inst/include/Rcpp/vector/const_string_proxy.h b/inst/include/Rcpp/vector/const_string_proxy.h index a890f2ac0..10c0b1bcd 100644 --- a/inst/include/Rcpp/vector/const_string_proxy.h +++ b/inst/include/Rcpp/vector/const_string_proxy.h @@ -2,7 +2,7 @@ // // const_string_proxy.h: Rcpp R/C++ interface class library -- // -// Copyright (C) 2013 Romain Francois +// Copyright (C) 2013 - 2018 Romain Francois // // This file is part of Rcpp. // @@ -25,10 +25,11 @@ namespace Rcpp{ namespace internal{ - template class const_string_proxy { + template class StoragePolicy> + class const_string_proxy { public: - typedef typename ::Rcpp::Vector VECTOR ; + typedef typename ::Rcpp::Vector VECTOR ; typedef const char* iterator ; typedef const char& reference ; @@ -43,7 +44,7 @@ namespace internal{ const_string_proxy( const VECTOR& v, R_xlen_t index_ ) : parent(&v), index(index_){} const_string_proxy(SEXP x): parent(0), index(0) { - Vector tmp(x); + VECTOR tmp(x); parent = &tmp; } @@ -76,11 +77,11 @@ namespace internal{ * Prints the element this proxy refers to to an * output stream */ - template - friend std::ostream& operator<<(std::ostream& os, const const_string_proxy& proxy); + template class StoragePolicy_> + friend std::ostream& operator<<(std::ostream& os, const const_string_proxy& proxy); - template - friend std::string operator+( const std::string& x, const const_string_proxy& proxy); + template class StoragePolicy_> + friend std::string operator+( const std::string& x, const const_string_proxy& proxy); const VECTOR* parent; R_xlen_t index ; @@ -110,13 +111,13 @@ namespace internal{ return strcmp( begin(), other.begin() ) != 0 ; } - bool operator==( SEXP other ) const { - return get() == other; - } + bool operator==( SEXP other ) const { + return get() == other; + } - bool operator!=( SEXP other ) const { - return get() != other; - } + bool operator!=( SEXP other ) const { + return get() != other; + } private: static std::string buffer ; @@ -155,20 +156,22 @@ namespace internal{ ) <= 0 ; } - template std::string const_string_proxy::buffer ; + template class StoragePolicy> std::string const_string_proxy::buffer ; - inline std::ostream& operator<<(std::ostream& os, const const_string_proxy& proxy) { + template