Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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 <edd@debian.org>
Expand Down
10 changes: 5 additions & 5 deletions inst/include/Rcpp/String.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down Expand Up @@ -483,8 +483,8 @@ namespace Rcpp {
}

namespace internal {
template <int RTYPE>
string_proxy<RTYPE>& string_proxy<RTYPE>::operator=(const String& s) {
template <int RTYPE, template <class> class StoragePolicy>
string_proxy<RTYPE, StoragePolicy>& string_proxy<RTYPE, StoragePolicy>::operator=(const String& s) {
set(s.get_sexp());
return *this;
}
Expand All @@ -500,9 +500,9 @@ namespace Rcpp {
return s.get_sexp();
}

template <int RTYPE>
template <int RTYPE, template <class> class StoragePolicy>
template <typename T>
string_proxy<RTYPE>& string_proxy<RTYPE>::operator+=(const T& rhs) {
string_proxy<RTYPE, StoragePolicy>& string_proxy<RTYPE, StoragePolicy>::operator+=(const T& rhs) {
String tmp = get();
tmp += rhs;
set(tmp);
Expand Down
2 changes: 1 addition & 1 deletion inst/include/Rcpp/internal/Proxy_Iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class Proxy_Iterator {
}

inline reference operator*() {
return proxy ;
return proxy ;
}
inline pointer operator->(){
return &proxy ;
Expand Down
26 changes: 13 additions & 13 deletions inst/include/Rcpp/vector/00_forward_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand All @@ -25,25 +25,25 @@
namespace Rcpp{

namespace internal{
template <int RTYPE> class string_proxy ;
template <int RTYPE> class const_string_proxy ;
template <int RTYPE> class generic_proxy ;
template <int RTYPE> class const_generic_proxy ;
template <int RTYPE> class simple_name_proxy ;
template <int RTYPE> class string_name_proxy ;
template <int RTYPE> class generic_name_proxy ;
template <int RTYPE, template <class> class StoragePolicy = PreserveStorage> class string_proxy ;
template <int RTYPE, template <class> class StoragePolicy = PreserveStorage> class const_string_proxy ;
template <int RTYPE, template <class> class StoragePolicy = PreserveStorage> class generic_proxy ;
template <int RTYPE, template <class> class StoragePolicy = PreserveStorage> class const_generic_proxy ;
template <int RTYPE, template <class> class StoragePolicy = PreserveStorage> class simple_name_proxy ;
template <int RTYPE, template <class> class StoragePolicy = PreserveStorage> class string_name_proxy ;
template <int RTYPE, template <class> class StoragePolicy = PreserveStorage> class generic_name_proxy ;
}

namespace traits {
template <int RTYPE, template <class> class StoragePolicy> struct r_vector_cache_type ;
template <int RTYPE, template <class> class StoragePolicy> class r_vector_cache ;

template <int RTYPE> struct r_vector_name_proxy ;
template <int RTYPE> struct r_vector_proxy ;
template <int RTYPE> struct r_vector_const_proxy ;
template <int RTYPE, template <class> class StoragePolicy = PreserveStorage> struct r_vector_name_proxy ;
template <int RTYPE, template <class> class StoragePolicy = PreserveStorage> struct r_vector_proxy ;
template <int RTYPE, template <class> class StoragePolicy = PreserveStorage> struct r_vector_const_proxy ;

template <int RTYPE> struct r_vector_iterator ;
template <int RTYPE> struct r_vector_const_iterator ;
template <int RTYPE, template <class> class StoragePolicy = PreserveStorage> struct r_vector_iterator ;
template <int RTYPE, template <class> class StoragePolicy = PreserveStorage> struct r_vector_const_iterator ;

}
}
Expand Down
15 changes: 8 additions & 7 deletions inst/include/Rcpp/vector/Vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down Expand Up @@ -40,12 +40,12 @@ class Vector :
typedef StoragePolicy<Vector> Storage ;

typename traits::r_vector_cache_type<RTYPE, StoragePolicy>::type cache ;
typedef typename traits::r_vector_proxy<RTYPE>::type Proxy ;
typedef typename traits::r_vector_const_proxy<RTYPE>::type const_Proxy ;
typedef typename traits::r_vector_name_proxy<RTYPE>::type NameProxy ;
typedef typename traits::r_vector_proxy<RTYPE>::type value_type ;
typedef typename traits::r_vector_iterator<RTYPE>::type iterator ;
typedef typename traits::r_vector_const_iterator<RTYPE>::type const_iterator ;
typedef typename traits::r_vector_proxy<RTYPE, StoragePolicy>::type Proxy ;
typedef typename traits::r_vector_const_proxy<RTYPE, StoragePolicy>::type const_Proxy ;
typedef typename traits::r_vector_name_proxy<RTYPE, StoragePolicy>::type NameProxy ;
typedef typename traits::r_vector_proxy<RTYPE, StoragePolicy>::type value_type ;
typedef typename traits::r_vector_iterator<RTYPE, StoragePolicy>::type iterator ;
typedef typename traits::r_vector_const_iterator<RTYPE, StoragePolicy>::type const_iterator ;
typedef typename traits::init_type<RTYPE>::type init_type ;
typedef typename traits::r_vector_element_converter<RTYPE>::type converter_type ;
typedef typename traits::storage_type<RTYPE>::type stored_type ;
Expand Down Expand Up @@ -936,6 +936,7 @@ class Vector :
}

R_xlen_t n = size() ;

Vector target( n - 1 ) ;
iterator target_it(target.begin()) ;
iterator it(begin()) ;
Expand Down
10 changes: 5 additions & 5 deletions inst/include/Rcpp/vector/const_generic_proxy.h
Original file line number Diff line number Diff line change
@@ -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.
//
Expand All @@ -23,10 +23,10 @@
namespace Rcpp{
namespace internal{

template <int RTYPE>
class const_generic_proxy : public GenericProxy< const_generic_proxy<RTYPE> > {
template <int RTYPE, template <class> class StoragePolicy>
class const_generic_proxy : public GenericProxy< const_generic_proxy<RTYPE, StoragePolicy> > {
public:
typedef typename ::Rcpp::Vector<RTYPE> VECTOR ;
typedef typename ::Rcpp::Vector<RTYPE, StoragePolicy> VECTOR ;

const_generic_proxy(): parent(0), index(-1){}

Expand All @@ -48,7 +48,7 @@ namespace internal{
operator int() const { return ::Rcpp::as<int>(get()) ; }

inline void move(R_xlen_t n) { index += n ; }

const VECTOR* parent;
R_xlen_t index ;

Expand Down
43 changes: 23 additions & 20 deletions inst/include/Rcpp/vector/const_string_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand All @@ -25,10 +25,11 @@
namespace Rcpp{
namespace internal{

template<int RTYPE> class const_string_proxy {
template<int RTYPE, template <class> class StoragePolicy>
class const_string_proxy {
public:

typedef typename ::Rcpp::Vector<RTYPE> VECTOR ;
typedef typename ::Rcpp::Vector<RTYPE, StoragePolicy> VECTOR ;
typedef const char* iterator ;
typedef const char& reference ;

Expand All @@ -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<RTYPE> tmp(x);
VECTOR tmp(x);
parent = &tmp;
}

Expand Down Expand Up @@ -76,11 +77,11 @@ namespace internal{
* Prints the element this proxy refers to to an
* output stream
*/
template <int RT>
friend std::ostream& operator<<(std::ostream& os, const const_string_proxy<RT>& proxy);
template <int RT, template <class> class StoragePolicy_>
friend std::ostream& operator<<(std::ostream& os, const const_string_proxy<RT, StoragePolicy_>& proxy);

template <int RT>
friend std::string operator+( const std::string& x, const const_string_proxy<RT>& proxy);
template <int RT, template <class> class StoragePolicy_>
friend std::string operator+( const std::string& x, const const_string_proxy<RT, StoragePolicy_>& proxy);

const VECTOR* parent;
R_xlen_t index ;
Expand Down Expand Up @@ -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 ;
Expand Down Expand Up @@ -155,20 +156,22 @@ namespace internal{
) <= 0 ;
}

template<int RTYPE> std::string const_string_proxy<RTYPE>::buffer ;
template<int RTYPE, template <class> class StoragePolicy> std::string const_string_proxy<RTYPE, StoragePolicy>::buffer ;

inline std::ostream& operator<<(std::ostream& os, const const_string_proxy<STRSXP>& proxy) {
template <template <class> class StoragePolicy>
inline std::ostream& operator<<(std::ostream& os, const const_string_proxy<STRSXP, StoragePolicy>& proxy) {
os << static_cast<const char*>(proxy) ;
return os;
}

inline std::string operator+( const std::string& x, const const_string_proxy<STRSXP>& y ){
template <template <class> class StoragePolicy>
inline std::string operator+( const std::string& x, const const_string_proxy<STRSXP, StoragePolicy>& y ){
return x + static_cast<const char*>(y) ;
}


template <int RTYPE>
string_proxy<RTYPE>& string_proxy<RTYPE>::operator=(const const_string_proxy<RTYPE>& other){
template <int RTYPE, template <class> class StoragePolicy1>
template <template <class> class StoragePolicy2>
string_proxy<RTYPE, StoragePolicy1>& string_proxy<RTYPE, StoragePolicy1>::operator=(const const_string_proxy<RTYPE, StoragePolicy2>& other){
set( other.get() ) ;
return *this ;
}
Expand Down
33 changes: 22 additions & 11 deletions inst/include/Rcpp/vector/generic_proxy.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// generic_proxy.h: Rcpp R/C++ interface class library --
//
// Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois
// Copyright (C) 2010 - 2018 Dirk Eddelbuettel and Romain Francois
//
// This file is part of Rcpp.
//
Expand All @@ -23,25 +23,34 @@
namespace Rcpp{
namespace internal{

template <int RTYPE>
class generic_proxy : public GenericProxy< generic_proxy<RTYPE> > {
template <int RTYPE, template <class> class StoragePolicy>
class generic_proxy : public GenericProxy< generic_proxy<RTYPE, StoragePolicy> > {
public:
typedef typename ::Rcpp::Vector<RTYPE> VECTOR ;
typedef typename ::Rcpp::Vector<RTYPE, StoragePolicy> VECTOR ;

generic_proxy(): parent(0), index(-1){}

generic_proxy( const generic_proxy& other ) :
parent(other.parent), index(other.index){} ;
parent(other.parent), index(other.index)
{}

generic_proxy( VECTOR& v, R_xlen_t i ) : parent(&v), index(i){} ;
generic_proxy( VECTOR& v, R_xlen_t i ) :
parent(&v), index(i)
{}

generic_proxy& operator=(SEXP rhs) {
set(rhs) ;
return *this ;
}

generic_proxy& operator=(const generic_proxy& rhs) {
set(rhs.get());
generic_proxy& operator=(const generic_proxy& rhs){
set(rhs.get());
return *this ;
}

template <template <class> class StoragePolicy2>
generic_proxy& operator=(const generic_proxy<RTYPE,StoragePolicy2>& rhs) {
set(rhs.get());
return *this ;
}

Expand Down Expand Up @@ -78,13 +87,15 @@ namespace internal{
index = other.index ;
}

inline SEXP get() const {
return VECTOR_ELT(*parent, index );
}

private:
inline void set(SEXP x) {
SET_VECTOR_ELT( *parent, index, x ) ;
}
inline SEXP get() const {
return VECTOR_ELT(*parent, index );
}


} ;

Expand Down
Loading