Template Struct pn532::with_inf
Defined in File data.hpp
Struct Documentation
-
template<class Integral>
struct with_inf Wrapper around an integral type that can take pn532::infty and assign to the underlying integer type its maximum value.
In the PN532, sometimes the natural maximum (
std::numeric_limits<Integral>::max()
) of an integral type is used to signal infinity, e.g. repeat an operation indefinitely. This template explicitly marks this property by adding some syntactic sugar to the type. This type behaves exactly like the underlying integral type, but moreover can be assigned and compared with pn532::infty.with_inf<int> i = infty; if (i == infty) { std::cout << "∞" << std::endl; } else { std::cout << i << std::endl; }
- Template Parameters:
Integral – Any integral type
Comparison operators
Compares against pn532::infty (i.e.
std::numeric_limits<Integral>::max()
).Public Functions
-
with_inf(bool) = delete
Prevents accidental cast from bool.