Skip to content

Commit 271e03d

Browse files
author
Florian Plaza Oñate
committed
Remove std::stringstream usage
1 parent 268a5c5 commit 271e03d

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

inst/include/Rcpp/vector/DimNameProxy.h

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,7 @@ namespace internal{
3636
inline DimNameProxy& operator=(SEXP other) {
3737
SEXP dims = Rf_getAttrib(data_, R_DimSymbol);
3838
if (INTEGER(dims)[dim_] != Rf_length(other)) {
39-
std::stringstream s;
40-
s << "dimension extent is '"
41-
<< INTEGER(dims)[dim_]
42-
<< "' while length of names is '"
43-
<< Rf_length(other)
44-
<< "'";
45-
stop(s.str());
39+
stop("dimension extent is '%d' while length of names is '%d'", INTEGER(dims)[dim_], Rf_length(other));
4640
}
4741
SEXP dimnames = Rf_getAttrib(data_, R_DimNamesSymbol);
4842
if (Rf_isNull(dimnames)) {
@@ -55,17 +49,10 @@ namespace internal{
5549
return *this;
5650
}
5751

58-
59-
inline DimNameProxy& operator=(const DimNameProxy& other) {
52+
inline DimNameProxy& operator=(const DimNameProxy& other) {
6053
SEXP dims = Rf_getAttrib(data_, R_DimSymbol);
6154
if (INTEGER(dims)[dim_] != INTEGER(dims)[other.dim_]) {
62-
std::stringstream s;
63-
s << "dimension extent is '"
64-
<< INTEGER(dims)[dim_]
65-
<< "' while length of names is '"
66-
<< INTEGER(dims)[other.dim_]
67-
<< "'";
68-
stop(s.str());
55+
stop("dimension extent is '%d' while length of names is '%d'", INTEGER(dims)[dim_], INTEGER(dims)[other.dim_]);
6956
}
7057
SEXP dimnames = Rf_getAttrib(data_, R_DimNamesSymbol);
7158
SEXP other_dimnames = SEXP(other);

0 commit comments

Comments
 (0)