Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions cpp/Platform.Ranges/Range.h
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
ο»Ώnamespace Platform::Ranges
{
#define LIMIT_AS_RANGE(type) std::numeric_limits<type>::lowest(), std::numeric_limits<type>::max()
namespace Internal
{
template<typename T>
constexpr Range<T> FullRange() noexcept
{
return Range<T>(std::numeric_limits<T>::lowest(), std::numeric_limits<T>::max());
}
}

constexpr auto SByte = Range(LIMIT_AS_RANGE(std::int8_t));
constexpr auto SByte = Internal::FullRange<std::int8_t>();

constexpr auto Int16 = Range(LIMIT_AS_RANGE(std::int16_t));
constexpr auto Int16 = Internal::FullRange<std::int16_t>();

constexpr auto Int32 = Range(LIMIT_AS_RANGE(std::int32_t));
constexpr auto Int32 = Internal::FullRange<std::int32_t>();

constexpr auto Int64 = Range(LIMIT_AS_RANGE(std::int64_t));
constexpr auto Int64 = Internal::FullRange<std::int64_t>();

constexpr auto Byte = Range(LIMIT_AS_RANGE(std::uint8_t));
constexpr auto Byte = Internal::FullRange<std::uint8_t>();

constexpr auto UInt16 = Range(LIMIT_AS_RANGE(std::uint16_t));
constexpr auto UInt16 = Internal::FullRange<std::uint16_t>();

constexpr auto UInt32 = Range(LIMIT_AS_RANGE(std::uint32_t));
constexpr auto UInt32 = Internal::FullRange<std::uint32_t>();

constexpr auto UInt64 = Range(LIMIT_AS_RANGE(std::uint64_t));
constexpr auto UInt64 = Internal::FullRange<std::uint64_t>();

constexpr auto Single = Range(LIMIT_AS_RANGE(std::float_t));
constexpr auto Single = Internal::FullRange<std::float_t>();

constexpr auto Double = Range(LIMIT_AS_RANGE(std::double_t));

#undef LIMIT_AS_RANGE
constexpr auto Double = Internal::FullRange<std::double_t>();
}
Loading