I'm writing C++ code in an environment in which I don't have access to the C++ standard library, specifically not to std::numeric_limits
. Suppose I want to implement
template <typename T> constexpr T all_ones( /* ... */ )
Focusing on unsigned integral types, what do I put there? Specifically, is static_cast<T>(-1)
good enough? (Other types I could treat as an array of unsigned chars based on their size I guess.)