Skip to content

Commit 9b2ab0b

Browse files
committed
Add Result support to Option
1 parent 04eb064 commit 9b2ab0b

File tree

9 files changed

+210
-117
lines changed

9 files changed

+210
-117
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ add_library(subspace STATIC
7676
"num/unsigned_integer.h"
7777
"option/__private/is_option_type.h"
7878
"option/option.h"
79+
"result/__private/is_result_type.h"
7980
"result/result.h"
8081
"tuple/__private/storage.h"
8182
"tuple/tuple.h"

num/__private/float_macros.h

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -705,16 +705,14 @@ class Array;
705705
/** Return the memory representation of this floating point number as a byte \
706706
* array in big-endian (network) byte order. \
707707
*/ \
708-
template <std::same_as<::sus::containers::Array<u8, Bytes>> Array = \
709-
::sus::containers::Array<u8, Bytes>> \
708+
template <int&..., class Array = ::sus::containers::Array<u8, Bytes>> \
710709
constexpr Array to_be_bytes() const& noexcept { \
711710
return to_bits().to_be_bytes(); \
712711
} \
713712
/** Return the memory representation of this floating point number as a byte \
714713
* array in little-endian byte order. \
715714
*/ \
716-
template <std::same_as<::sus::containers::Array<u8, Bytes>> Array = \
717-
::sus::containers::Array<u8, Bytes>> \
715+
template <int&..., class Array = ::sus::containers::Array<u8, Bytes>> \
718716
constexpr Array to_le_bytes() const& noexcept { \
719717
return to_bits().to_le_bytes(); \
720718
} \
@@ -724,8 +722,7 @@ class Array;
724722
* As the target platform's native endianness is used, portable code should \
725723
* use `to_be_bytes()` or `to_le_bytes()`, as appropriate, instead. \
726724
*/ \
727-
template <std::same_as<::sus::containers::Array<u8, Bytes>> Array = \
728-
::sus::containers::Array<u8, Bytes>> \
725+
template <int&..., class Array = ::sus::containers::Array<u8, Bytes>> \
729726
constexpr Array to_ne_bytes() const& noexcept { \
730727
return to_bits().to_ne_bytes(); \
731728
} \
@@ -734,8 +731,7 @@ class Array;
734731
* \
735732
* See `##T##::from_bits()` for why this function is not constexpr. \
736733
*/ \
737-
template <std::same_as<::sus::containers::Array<u8, Bytes>> Array = \
738-
::sus::containers::Array<u8, Bytes>> \
734+
template <int&..., class Array = ::sus::containers::Array<u8, Bytes>> \
739735
static T from_be_bytes(const Array& bytes) noexcept { \
740736
return T::from_bits(UnsignedIntT::from_be_bytes(bytes)); \
741737
} \
@@ -744,8 +740,7 @@ class Array;
744740
* \
745741
* See `##T##::from_bits()` for why this function is not constexpr. \
746742
*/ \
747-
template <std::same_as<::sus::containers::Array<u8, Bytes>> Array = \
748-
::sus::containers::Array<u8, Bytes>> \
743+
template <int&..., class Array = ::sus::containers::Array<u8, Bytes>> \
749744
static T from_le_bytes(const Array& bytes) noexcept { \
750745
return T::from_bits(UnsignedIntT::from_le_bytes(bytes)); \
751746
} \
@@ -758,8 +753,7 @@ class Array;
758753
* \
759754
* See `##T##::from_bits()` for why this function is not constexpr. \
760755
*/ \
761-
template <std::same_as<::sus::containers::Array<u8, Bytes>> Array = \
762-
::sus::containers::Array<u8, Bytes>> \
756+
template <int&..., class Array = ::sus::containers::Array<u8, Bytes>> \
763757
static T from_ne_bytes(const Array& bytes) noexcept { \
764758
return T::from_bits(UnsignedIntT::from_ne_bytes(bytes)); \
765759
}

0 commit comments

Comments
 (0)