tatami
C++ API for different matrix representations
Loading...
Searching...
No Matches
integer_comparisons.hpp
Go to the documentation of this file.
1#ifndef TATAMI_SAFE_NON_NEGATIVE_EQUAL_HPP
2#define TATAMI_SAFE_NON_NEGATIVE_EQUAL_HPP
3
4#include <type_traits>
5
11namespace tatami {
12
22template<typename Left_, typename Right_>
23bool safe_non_negative_equal(Left_ l, Right_ r) {
24 return l >= 0 && r >= 0 && static_cast<typename std::make_unsigned<Left_>::type>(l) == static_cast<typename std::make_unsigned<Right_>::type>(r);
25}
26
27}
28
29#endif
Flexible representations for matrix data.
Definition Extractor.hpp:15
bool safe_non_negative_equal(Left_ l, Right_ r)
Definition integer_comparisons.hpp:23