Skip to content

Commit 4bb97a8

Browse files
fixed const correctness of Vector::const_iterator. closes #209
1 parent 0618420 commit 4bb97a8

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

inst/NEWS.Rd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
implementation in Rcpp11)
1717
\item Pairlist objects are now protected via an additional \code{Shield<>}
1818
as suggested by Martin Morgan on the rcpp-devel list.
19+
\item Fixed \code{const} correctness of \code{Vector::const\_iterator}. Problem
20+
raised by Martyn Plummer on \code{Rcpp-devel}.
1921
}
2022
\item Changes in Rcpp Attributes:
2123
\itemize{

inst/include/Rcpp/sugar/functions/setdiff.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// setdiff.h: Rcpp R/C++ interface class library -- setdiff
44
//
5-
// Copyright (C) 2012 Dirk Eddelbuettel and Romain Francois
5+
// Copyright (C) 2012 - 2014 Dirk Eddelbuettel and Romain Francois
66
//
77
// This file is part of Rcpp.
88
//
@@ -55,7 +55,7 @@ namespace sugar{
5555
Vector<RTYPE> get() const {
5656
int n = lhs_set.size() ;
5757
Vector<RTYPE> out = no_init(n) ;
58-
std::copy( lhs_set.begin(), lhs_set.end(), get_const_begin(out) ) ;
58+
std::copy( lhs_set.begin(), lhs_set.end(), out.begin() ) ;
5959
return out ;
6060
}
6161

@@ -120,7 +120,7 @@ namespace sugar{
120120
Vector<RTYPE> get() const {
121121
int n = intersect.size() ;
122122
Vector<RTYPE> out = no_init(n) ;
123-
std::copy( intersect.begin(), intersect.end(), get_const_begin(out) ) ;
123+
std::copy( intersect.begin(), intersect.end(), out.begin() ) ;
124124
return out ;
125125
}
126126

@@ -145,7 +145,7 @@ namespace sugar{
145145
Vector<RTYPE> get() const {
146146
int n = result.size() ;
147147
Vector<RTYPE> out = no_init(n) ;
148-
std::copy( result.begin(), result.end(), get_const_begin(out) ) ;
148+
std::copy( result.begin(), result.end(), out.begin() ) ;
149149
return out ;
150150
}
151151

inst/include/Rcpp/sugar/matrix/as_vector.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// as_vector.h: Rcpp R/C++ interface class library -- as_vector( sugar matrix expression )
44
//
5-
// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
5+
// Copyright (C) 2010 - 2014 Dirk Eddelbuettel and Romain Francois
66
//
77
// This file is part of Rcpp.
88
//
@@ -44,7 +44,7 @@ inline Rcpp::Vector<RTYPE>
4444
as_vector__impl( MatrixBase<RTYPE,NA,T>& t, Rcpp::traits::true_type ){
4545
Matrix<RTYPE>& ref = t.get_ref() ;
4646
int size = ref.ncol()*ref.nrow() ;
47-
typename Rcpp::Vector<RTYPE>::iterator first(static_cast<const Rcpp::Vector<RTYPE>&>(ref).begin()) ;
47+
typename Rcpp::Vector<RTYPE>::const_iterator first(static_cast<const Rcpp::Vector<RTYPE>&>(ref).begin()) ;
4848
return Vector<RTYPE>(first, first+size );
4949
}
5050

inst/include/Rcpp/sugar/nona/nona.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ namespace sugar {
4646
public:
4747
typedef typename Rcpp::VectorBase<RTYPE,NA, Rcpp::Vector<RTYPE> > SUGAR_TYPE ;
4848
typedef typename Rcpp::traits::storage_type<RTYPE>::type STORAGE ;
49-
typedef typename Rcpp::Vector<RTYPE>::iterator iterator ;
49+
typedef typename Rcpp::Vector<RTYPE>::const_iterator iterator ;
5050

5151
Nona( const SUGAR_TYPE& expr) : data(expr.get_ref().begin()), n(expr.size()){}
5252

0 commit comments

Comments
 (0)