Skip to content

Commit

Permalink
Update status-code.
Browse files Browse the repository at this point in the history
  • Loading branch information
ned14 committed Jun 28, 2023
1 parent 3aac409 commit c8853a2
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 31 deletions.
6 changes: 3 additions & 3 deletions include/outcome/detail/revision.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ Distributed under the Boost Software License, Version 1.0.
*/

// Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time
#define OUTCOME_PREVIOUS_COMMIT_REF 8131678356386003aa10b1cde2c0ff274579acdd
#define OUTCOME_PREVIOUS_COMMIT_DATE "2023-04-27 13:52:03 +00:00"
#define OUTCOME_PREVIOUS_COMMIT_UNIQUE 81316783
#define OUTCOME_PREVIOUS_COMMIT_REF 3aac409501c9ecc770d175aa7f4597fea9527b80
#define OUTCOME_PREVIOUS_COMMIT_DATE "2023-06-28 11:31:22 +00:00"
#define OUTCOME_PREVIOUS_COMMIT_UNIQUE 3aac4095
2 changes: 1 addition & 1 deletion include/outcome/experimental/status-code
6 changes: 3 additions & 3 deletions single-header/outcome-basic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -996,9 +996,9 @@ Distributed under the Boost Software License, Version 1.0.
http://www.boost.org/LICENSE_1_0.txt)
*/
// Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time
#define OUTCOME_PREVIOUS_COMMIT_REF 8131678356386003aa10b1cde2c0ff274579acdd
#define OUTCOME_PREVIOUS_COMMIT_DATE "2023-04-27 13:52:03 +00:00"
#define OUTCOME_PREVIOUS_COMMIT_UNIQUE 81316783
#define OUTCOME_PREVIOUS_COMMIT_REF 3aac409501c9ecc770d175aa7f4597fea9527b80
#define OUTCOME_PREVIOUS_COMMIT_DATE "2023-06-28 11:31:22 +00:00"
#define OUTCOME_PREVIOUS_COMMIT_UNIQUE 3aac4095
#define OUTCOME_V2 (QUICKCPPLIB_BIND_NAMESPACE_VERSION(outcome_v2))
#ifdef _DEBUG
#define OUTCOME_V2_CXX_MODULE_NAME QUICKCPPLIB_BIND_NAMESPACE((QUICKCPPLIB_BIND_NAMESPACE_VERSION(outcome_v2d)))
Expand Down
61 changes: 40 additions & 21 deletions single-header/outcome-experimental.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1021,9 +1021,9 @@ Distributed under the Boost Software License, Version 1.0.
http://www.boost.org/LICENSE_1_0.txt)
*/
// Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time
#define OUTCOME_PREVIOUS_COMMIT_REF 8131678356386003aa10b1cde2c0ff274579acdd
#define OUTCOME_PREVIOUS_COMMIT_DATE "2023-04-27 13:52:03 +00:00"
#define OUTCOME_PREVIOUS_COMMIT_UNIQUE 81316783
#define OUTCOME_PREVIOUS_COMMIT_REF 3aac409501c9ecc770d175aa7f4597fea9527b80
#define OUTCOME_PREVIOUS_COMMIT_DATE "2023-06-28 11:31:22 +00:00"
#define OUTCOME_PREVIOUS_COMMIT_UNIQUE 3aac4095
#define OUTCOME_V2 (QUICKCPPLIB_BIND_NAMESPACE_VERSION(outcome_v2))
#ifdef _DEBUG
#define OUTCOME_V2_CXX_MODULE_NAME QUICKCPPLIB_BIND_NAMESPACE((QUICKCPPLIB_BIND_NAMESPACE_VERSION(outcome_v2d)))
Expand Down Expand Up @@ -6587,7 +6587,7 @@ Distributed under the Boost Software License, Version 1.0.
#define SYSTEM_ERROR2_NODISCARD __attribute__((warn_unused_result))
#elif defined(_MSC_VER)
// _Must_inspect_result_ expands into this
#define SYSTEM_ERROR2_NODISCARD __declspec("SAL_name" "(" "\"_Must_inspect_result_\"" "," "\"\"" "," "\"2\"" ")") __declspec("SAL_begin") __declspec("SAL_post") __declspec("SAL_mustInspect") __declspec("SAL_post") __declspec("SAL_checkReturn") __declspec("SAL_end")
#define SYSTEM_ERROR2_NODISCARD __declspec( "SAL_name" "(" "\"_Must_inspect_result_\"" "," "\"\"" "," "\"2\"" ")") __declspec("SAL_begin") __declspec("SAL_post") __declspec("SAL_mustInspect") __declspec("SAL_post") __declspec("SAL_checkReturn") __declspec("SAL_end")
#endif
#endif
#ifndef SYSTEM_ERROR2_NODISCARD
Expand Down Expand Up @@ -6699,8 +6699,11 @@ namespace detail
*/
template <class T> using is_integral_or_enum = std::integral_constant<bool, std::is_integral<T>::value || std::is_enum<T>::value>;
template <class To, class From> using is_static_castable = std::integral_constant<bool, is_integral_or_enum<To>::value && is_integral_or_enum<From>::value>;
template <class To, class From> using is_union_castable = std::integral_constant<bool, !is_static_castable<To, From>::value && !std::is_array<To>::value && !std::is_array<From>::value>;
template <class To, class From> using is_bit_castable = std::integral_constant<bool, sizeof(To) == sizeof(From) && traits::is_move_bitcopying<To>::value && traits::is_move_bitcopying<From>::value>;
template <class To, class From>
using is_union_castable = std::integral_constant<bool, !is_static_castable<To, From>::value && !std::is_array<To>::value && !std::is_array<From>::value>;
template <class To, class From>
using is_bit_castable =
std::integral_constant<bool, sizeof(To) == sizeof(From) && traits::is_move_bitcopying<To>::value && traits::is_move_bitcopying<From>::value>;
template <class To, class From> union bit_cast_union
{
From source;
Expand All @@ -6723,7 +6726,8 @@ namespace detail
&& !is_union_castable<To, From>::value //
&& (!std::is_trivially_copyable_v<From> //
|| !std::is_trivially_copyable_v<To>) ) //
To bit_cast(const From &from) noexcept
To bit_cast(const From &from)
noexcept
{
bit_cast_union<To, From> ret;
memmove(&ret.source, &from, sizeof(ret.source));
Expand Down Expand Up @@ -6764,7 +6768,8 @@ namespace detail
conversion with bit_cast. When casting to or from non-integral, non-enum
types it may insert the value into another object with extra padding bytes
to satisfy bit_cast's preconditions that both types have the same size. */
template <class To, class From> using is_erasure_castable = std::integral_constant<bool, traits::is_move_bitcopying<To>::value && traits::is_move_bitcopying<From>::value>;
template <class To, class From>
using is_erasure_castable = std::integral_constant<bool, traits::is_move_bitcopying<To>::value && traits::is_move_bitcopying<From>::value>;
template <class T, bool = std::is_enum<T>::value> struct identity_or_underlying_type
{
using type = T;
Expand All @@ -6774,7 +6779,9 @@ namespace detail
using type = typename std::underlying_type<T>::type;
};
template <class OfSize, class OfSign>
using erasure_integer_type = typename std::conditional<std::is_signed<typename identity_or_underlying_type<OfSign>::type>::value, typename std::make_signed<typename identity_or_underlying_type<OfSize>::type>::type, typename std::make_unsigned<typename identity_or_underlying_type<OfSize>::type>::type>::type;
using erasure_integer_type = typename std::conditional<std::is_signed<typename identity_or_underlying_type<OfSign>::type>::value,
typename std::make_signed<typename identity_or_underlying_type<OfSize>::type>::type,
typename std::make_unsigned<typename identity_or_underlying_type<OfSize>::type>::type>::type;
template <class ErasedType, std::size_t N> struct padded_erasure_object
{
static_assert(traits::is_move_bitcopying<ErasedType>::value, "ErasedType must be TriviallyCopyable or MoveBitcopying");
Expand All @@ -6788,15 +6795,30 @@ namespace detail
}
};
SYSTEM_ERROR2_TEMPLATE(class To, class From)
SYSTEM_ERROR2_TREQUIRES(SYSTEM_ERROR2_TPRED(is_erasure_castable<To, From>::value && (sizeof(To) == sizeof(From)))) constexpr To erasure_cast(const From &from) noexcept { return bit_cast<To>(from); }
SYSTEM_ERROR2_TREQUIRES(SYSTEM_ERROR2_TPRED(is_erasure_castable<To, From>::value && (sizeof(To) == sizeof(From))))
constexpr To erasure_cast(const From &from) noexcept { return bit_cast<To>(from); }
#if defined(_WIN32) || defined(__APPLE__) || __LITTLE_ENDIAN__ || (defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && __BYTE_ORDER == __LITTLE_ENDIAN)
// We can avoid the type pun on little endian architectures which can aid optimisation
SYSTEM_ERROR2_TEMPLATE(class To, class From, long = 5)
SYSTEM_ERROR2_TREQUIRES(SYSTEM_ERROR2_TPRED(is_erasure_castable<To, From>::value &&is_static_castable<To, From>::value && (sizeof(To) < sizeof(From)))) constexpr To erasure_cast(const From &from) noexcept { return static_cast<To>(bit_cast<erasure_integer_type<From, To>>(from)); }
SYSTEM_ERROR2_TREQUIRES(SYSTEM_ERROR2_TPRED(is_erasure_castable<To, From>::value &&is_static_castable<To, From>::value && (sizeof(To) < sizeof(From))))
constexpr To erasure_cast(const From &from) noexcept { return static_cast<To>(bit_cast<erasure_integer_type<From, To>>(from)); }
SYSTEM_ERROR2_TEMPLATE(class To, class From, int = 5)
SYSTEM_ERROR2_TREQUIRES(SYSTEM_ERROR2_TPRED(is_erasure_castable<To, From>::value &&is_static_castable<To, From>::value && (sizeof(To) > sizeof(From)))) constexpr To erasure_cast(const From &from) noexcept { return bit_cast<To>(static_cast<erasure_integer_type<To, From>>(from)); }
SYSTEM_ERROR2_TREQUIRES(SYSTEM_ERROR2_TPRED(is_erasure_castable<To, From>::value &&is_static_castable<To, From>::value && (sizeof(To) > sizeof(From))))
constexpr To erasure_cast(const From &from) noexcept { return bit_cast<To>(static_cast<erasure_integer_type<To, From>>(from)); }
SYSTEM_ERROR2_TEMPLATE(class To, class From, short = 5)
SYSTEM_ERROR2_TREQUIRES(SYSTEM_ERROR2_TPRED(is_erasure_castable<To, From>::value && !is_static_castable<To, From>::value && (sizeof(To) < sizeof(From)))) constexpr To erasure_cast(const From &from) noexcept { return bit_cast<padded_erasure_object<To, sizeof(From) - sizeof(To)>>(from).value; }
SYSTEM_ERROR2_TREQUIRES(SYSTEM_ERROR2_TPRED(is_erasure_castable<To, From>::value && !is_static_castable<To, From>::value && (sizeof(To) < sizeof(From))))
constexpr To erasure_cast(const From &from) noexcept { return bit_cast<padded_erasure_object<To, sizeof(From) - sizeof(To)>>(from).value; }
SYSTEM_ERROR2_TEMPLATE(class To, class From, char = 5)
SYSTEM_ERROR2_TREQUIRES(SYSTEM_ERROR2_TPRED(is_erasure_castable<To, From>::value && !is_static_castable<To, From>::value && (sizeof(To) > sizeof(From)))) constexpr To erasure_cast(const From &from) noexcept { return bit_cast<To>(padded_erasure_object<From, sizeof(To) - sizeof(From)>{from}); }
SYSTEM_ERROR2_TREQUIRES(SYSTEM_ERROR2_TPRED(is_erasure_castable<To, From>::value && !is_static_castable<To, From>::value && (sizeof(To) > sizeof(From))))
constexpr To erasure_cast(const From &from) noexcept { return bit_cast<To>(padded_erasure_object<From, sizeof(To) - sizeof(From)>{from}); }
#else
SYSTEM_ERROR2_TEMPLATE(class To, class From, short = 5)
SYSTEM_ERROR2_TREQUIRES(SYSTEM_ERROR2_TPRED(is_erasure_castable<To, From>::value && (sizeof(To) < sizeof(From))))
constexpr To erasure_cast(const From &from) noexcept { return bit_cast<padded_erasure_object<To, sizeof(From) - sizeof(To)>>(from).value; }
SYSTEM_ERROR2_TEMPLATE(class To, class From, char = 5)
SYSTEM_ERROR2_TREQUIRES(SYSTEM_ERROR2_TPRED(is_erasure_castable<To, From>::value && (sizeof(To) > sizeof(From))))
constexpr To erasure_cast(const From &from) noexcept { return bit_cast<To>(padded_erasure_object<From, sizeof(To) - sizeof(From)>{from}); }
#endif
} // namespace detail
SYSTEM_ERROR2_NAMESPACE_END
#ifndef SYSTEM_ERROR2_FATAL
Expand Down Expand Up @@ -7793,13 +7815,10 @@ class SYSTEM_ERROR2_TRIVIAL_ABI status_code<detail::erased<ErasedType>>
SYSTEM_ERROR2_CONSTEXPR14 status_code(status_code<DomainType> &&v) noexcept // NOLINT
: _base(typename _base::_value_type_constructor{}, v._domain_ptr(), detail::erasure_cast<value_type>(v.value()))
{
union
{
int a;
typename DomainType::value_type b;
};
new(std::addressof(b)) typename DomainType::value_type(static_cast<status_code<DomainType> &&>(v).value());
// deliberately do not destruct b
alignas(alignof(typename DomainType::value_type)) char buffer[sizeof(typename DomainType::value_type)];
new(buffer) typename DomainType::value_type(static_cast<status_code<DomainType> &&>(v).value());
// deliberately do not destruct value moved into buffer
(void) buffer;
v._domain = nullptr;
}
//! Implicit construction from any type where an ADL discovered `make_status_code(T, Args ...)` returns a `status_code`.
Expand Down
6 changes: 3 additions & 3 deletions single-header/outcome.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1020,9 +1020,9 @@ Distributed under the Boost Software License, Version 1.0.
http://www.boost.org/LICENSE_1_0.txt)
*/
// Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time
#define OUTCOME_PREVIOUS_COMMIT_REF 8131678356386003aa10b1cde2c0ff274579acdd
#define OUTCOME_PREVIOUS_COMMIT_DATE "2023-04-27 13:52:03 +00:00"
#define OUTCOME_PREVIOUS_COMMIT_UNIQUE 81316783
#define OUTCOME_PREVIOUS_COMMIT_REF 3aac409501c9ecc770d175aa7f4597fea9527b80
#define OUTCOME_PREVIOUS_COMMIT_DATE "2023-06-28 11:31:22 +00:00"
#define OUTCOME_PREVIOUS_COMMIT_UNIQUE 3aac4095
#define OUTCOME_V2 (QUICKCPPLIB_BIND_NAMESPACE_VERSION(outcome_v2))
#ifdef _DEBUG
#define OUTCOME_V2_CXX_MODULE_NAME QUICKCPPLIB_BIND_NAMESPACE((QUICKCPPLIB_BIND_NAMESPACE_VERSION(outcome_v2d)))
Expand Down

0 comments on commit c8853a2

Please sign in to comment.