diff --git a/ostd/range.hh b/ostd/range.hh index 36a578d..425ade1 100644 --- a/ostd/range.hh +++ b/ostd/range.hh @@ -71,11 +71,8 @@ namespace detail { // is input range namespace detail { - template, InputRangeTag>> - constexpr bool IsInputRangeCore = false; - - template - constexpr bool IsInputRangeCore = true; + template constexpr bool IsInputRangeCore + = IsConvertible, InputRangeTag>; template::value> constexpr bool IsInputRangeBase = false; @@ -90,11 +87,8 @@ constexpr bool IsInputRange = detail::IsInputRangeBase; // is forward range namespace detail { - template, ForwardRangeTag>> - constexpr bool IsForwardRangeCore = false; - - template - constexpr bool IsForwardRangeCore = true; + template constexpr bool IsForwardRangeCore + = IsConvertible, ForwardRangeTag>; template::value> constexpr bool IsForwardRangeBase = false; @@ -109,12 +103,8 @@ constexpr bool IsForwardRange = detail::IsForwardRangeBase; // is bidirectional range namespace detail { - template, BidirectionalRangeTag - >> constexpr bool IsBidirectionalRangeCore = false; - - template - constexpr bool IsBidirectionalRangeCore = true; + template constexpr bool IsBidirectionalRangeCore + = IsConvertible, BidirectionalRangeTag>; template::value> constexpr bool IsBidirectionalRangeBase = false; @@ -130,12 +120,8 @@ template constexpr bool IsBidirectionalRange // is random access range namespace detail { - template, RandomAccessRangeTag - >> constexpr bool IsRandomAccessRangeCore = false; - - template - constexpr bool IsRandomAccessRangeCore = true; + template constexpr bool IsRandomAccessRangeCore + = IsConvertible, RandomAccessRangeTag>; template::value> constexpr bool IsRandomAccessRangeBase = false; @@ -151,12 +137,8 @@ template constexpr bool IsRandomAccessRange // is finite random access range namespace detail { - template, FiniteRandomAccessRangeTag - >> constexpr bool IsFiniteRandomAccessRangeCore = false; - - template - constexpr bool IsFiniteRandomAccessRangeCore = true; + template constexpr bool IsFiniteRandomAccessRangeCore + = IsConvertible, FiniteRandomAccessRangeTag>; template::value> constexpr bool IsFiniteRandomAccessRangeBase = false; @@ -177,12 +159,8 @@ template constexpr bool IsInfiniteRandomAccessRange // is contiguous range namespace detail { - template, ContiguousRangeTag - >> constexpr bool IsContiguousRangeCore = false; - - template - constexpr bool IsContiguousRangeCore = true; + template constexpr bool IsContiguousRangeCore + = IsConvertible, ContiguousRangeTag>; template::value> constexpr bool IsContiguousRangeBase = false; @@ -206,16 +184,12 @@ namespace detail { static constexpr bool value = (sizeof(test(0)) == sizeof(char)); }; - template, OutputRangeTag - > || (IsInputRange && - (detail::OutputRangeTest &>::value || - detail::OutputRangeTest &&>::value || - detail::OutputRangeTest >::value) - ))> constexpr bool IsOutputRangeCore = false; - - template - constexpr bool IsOutputRangeCore = true; + template constexpr bool IsOutputRangeCore + = IsConvertible, OutputRangeTag> || + (IsInputRange && + (detail::OutputRangeTest &>::value || + detail::OutputRangeTest &&>::value || + detail::OutputRangeTest >::value)); template::value> constexpr bool IsOutputRangeBase = false;