MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / max

Function max

inst/include/Rcpp/algorithm.h:298–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296
297template< typename InputIterator >
298typename traits::enable_if< helpers::decays_to_ctype< typename std::iterator_traits< InputIterator >::value_type >::value,
299 typename helpers::ctype< typename std::iterator_traits< InputIterator >::value_type >::type >::type
300 max(InputIterator begin, InputIterator end) {
301
302 typedef typename helpers::ctype< typename std::iterator_traits< InputIterator >::value_type >::type value_type;
303 typedef typename helpers::rtype< value_type > rtype;
304
305 if (begin != end) {
306 value_type max = *begin;
307
308 while (begin != end) {
309 if (!Vector< rtype::RTYPE >::is_na(*begin)) {
310 max = std::max(max, *begin++);
311 } else {
312 return rtype::NA();
313 }
314 }
315
316 return max;
317 }
318
319 return std::numeric_limits< typename rtype::type >::infinity() * -rtype::ONE();
320}
321
322template< typename InputIterator >
323typename traits::enable_if< helpers::decays_to_ctype< typename std::iterator_traits< InputIterator >::value_type >::value,

Callers 6

max_nonaFunction · 0.70
maxTestFunction · 0.50
maxTest_intFunction · 0.50
runit_RangeIndexerFunction · 0.50
intmaxFunction · 0.50
doublemaxFunction · 0.50

Calls 1

is_naFunction · 0.50

Tested by

no test coverage detected