File tree Expand file tree Collapse file tree 4 files changed +35
-15
lines changed
include/Rcpp/sugar/functions Expand file tree Collapse file tree 4 files changed +35
-15
lines changed Original file line number Diff line number Diff line change
1
+ 2018-07-20 Dirk Eddelbuettel <
[email protected] >
2
+
3
+ * inst/include/Rcpp/sugar/functions/max.h (Rcpp): Also consider case
4
+ of an empty vector
5
+ * inst/include/Rcpp/sugar/functions/min.h (Rcpp): Idem
6
+
7
+ 2018-07-19 Jack Wasey <
[email protected] >
8
+
9
+ * inst/include/Rcpp/r_cast.h: Error and abort if debugging for STRSXP
10
+
1
11
2018-07-12 Dirk Eddelbuettel <
[email protected] >
2
12
3
13
* DESCRIPTION (Version, Date): Roll minor version
Original file line number Diff line number Diff line change 14
14
\item Next \code {eval } codes now properly unwind (Lionel in the large
15
15
and careful \ghpr {859 } fixing \ghit {807 }).
16
16
\item In debugging mode , more type information is shown on
17
- \code {abort()} (Jack Waseyin \ghpr {860 } fixing \ghit {857 }).
17
+ \code {abort()} (Jack Waseyin \ghpr {860 } and \ghpr {882 } fixing
18
+ \ghit {857 }).
18
19
\item A new class was added which allow suspension of the RNG
19
20
synchronisation to address an issue seen in \CRANpkg {RcppDE }
20
21
(Kevin in \ghpr {862 }).
30
31
\item The \code {Rcpp :: unwindProtect()} function extracts the
31
32
unwinding from the \code {Rcpp_fast_eval()} function and makes it
32
33
more generally available. (Lionel in \ghpr {873 } and \ghpr {877 }).
33
- \item The \code {tm_gmtoff } part is skipped on AIX too (\ghpr {876 }).
34
+ \item The \code {tm_gmtoff } part is skipped on AIX too
35
+ (\ghpr {876 }).
34
36
}
35
37
\item Changes in Rcpp Attributes :
36
38
\itemize {
41
43
the \code {RcppExports } files are more stable across locales (Jack
42
44
Wasey in \ghpr {878 }).
43
45
}
46
+ \item Changes in Rcpp Sugar :
47
+ \itemize {
48
+ \item The sugar functions \code {min } and \code {max } now recognise
49
+ empty vectors (Dirk in \ghpr {884 } fixing \ghit {883 }).
50
+ }
44
51
}
45
52
}
46
53
Original file line number Diff line number Diff line change 1
- // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
2
- //
1
+
3
2
// max.h: Rcpp R/C++ interface class library -- max
4
3
//
5
- // Copyright (C) 2012 - 2013 Dirk Eddelbuettel and Romain Francois
4
+ // Copyright (C) 2012 - 2018 Dirk Eddelbuettel and Romain Francois
6
5
//
7
6
// This file is part of Rcpp.
8
7
//
@@ -33,11 +32,12 @@ namespace sugar{
33
32
Max ( const T& obj_) : obj(obj_) {}
34
33
35
34
operator STORAGE () const {
35
+ R_xlen_t n = obj.size ();
36
+ if (n == 0 ) return (static_cast <STORAGE>(R_NegInf));
37
+
36
38
STORAGE max, current ;
37
39
max = obj[0 ] ;
38
40
if ( Rcpp::traits::is_na<RTYPE>( max ) ) return max ;
39
-
40
- R_xlen_t n = obj.size () ;
41
41
for ( R_xlen_t i=1 ; i<n; i++){
42
42
current = obj[i] ;
43
43
if ( Rcpp::traits::is_na<RTYPE>( current ) ) return current;
@@ -59,10 +59,11 @@ namespace sugar{
59
59
Max ( const T& obj_) : obj(obj_) {}
60
60
61
61
operator STORAGE () const {
62
+ R_xlen_t n = obj.size ();
63
+ if (n == 0 ) return (static_cast <STORAGE>(R_NegInf));
64
+
62
65
STORAGE max, current ;
63
66
max = obj[0 ] ;
64
-
65
- R_xlen_t n = obj.size () ;
66
67
for ( R_xlen_t i=1 ; i<n; i++){
67
68
current = obj[i] ;
68
69
if ( current > max ) max = current ;
Original file line number Diff line number Diff line change 1
- // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
2
- //
1
+
3
2
// Min.h: Rcpp R/C++ interface class library -- min
4
3
//
5
- // Copyright (C) 2012 - 2013 Dirk Eddelbuettel and Romain Francois
4
+ // Copyright (C) 2012 - 2018 Dirk Eddelbuettel and Romain Francois
6
5
//
7
6
// This file is part of Rcpp.
8
7
//
@@ -33,11 +32,13 @@ namespace sugar{
33
32
Min ( const T& obj_) : obj(obj_) {}
34
33
35
34
operator STORAGE () const {
35
+ R_xlen_t n = obj.size ();
36
+ if (n == 0 ) return (static_cast <STORAGE>(R_PosInf));
37
+
36
38
STORAGE min, current ;
37
39
min = obj[0 ] ;
38
40
if ( Rcpp::traits::is_na<RTYPE>( min ) ) return min ;
39
41
40
- R_xlen_t n = obj.size () ;
41
42
for ( R_xlen_t i=1 ; i<n; i++){
42
43
current = obj[i] ;
43
44
if ( Rcpp::traits::is_na<RTYPE>( current ) ) return current;
@@ -58,10 +59,11 @@ namespace sugar{
58
59
Min ( const T& obj_) : obj(obj_) {}
59
60
60
61
operator STORAGE () const {
62
+ R_xlen_t n = obj.size ();
63
+ if (n == 0 ) return (static_cast <STORAGE>(R_PosInf));
64
+
61
65
STORAGE min, current ;
62
66
min = obj[0 ] ;
63
-
64
- R_xlen_t n = obj.size () ;
65
67
for ( R_xlen_t i=1 ; i<n; i++){
66
68
current = obj[i] ;
67
69
if ( current < min ) min = current ;
You can’t perform that action at this time.
0 commit comments