might've borked expected

v1
Brett 2024-08-12 02:08:51 -04:00
parent 92300bc6a2
commit 644f426843
3 changed files with 29 additions and 9 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.20)
include(cmake/color.cmake)
set(BLT_VERSION 0.18.29)
set(BLT_VERSION 0.18.30)
set(BLT_TEST_VERSION 0.0.1)
set(BLT_TARGET BLT)

View File

@ -113,7 +113,7 @@ namespace blt
};
template<typename T, typename E, bool = std::is_copy_constructible_v<T>>
template<typename T, typename E, bool = std::is_copy_constructible_v<T>, bool = std::is_default_constructible_v<T>>
class expected
{
protected:
@ -131,10 +131,6 @@ namespace blt
std::is_constructible_v<unexpected<E>, expected<U, G>&> || std::is_constructible_v<unexpected<E>, expected<U, G>> ||
std::is_constructible_v<unexpected<E>, const expected<U, G>&> || std::is_constructible_v<unexpected<E>, const expected<U, G>>;
public:
template<typename std::enable_if_t<std::is_default_constructible_v<T>, bool> = true>
constexpr expected() noexcept: v(T())
{}
// constexpr expected(const expected& copy) = delete;
constexpr expected(const expected<T, E, true>& copy): expected<T, E, true>::v(copy.v)
{}
@ -371,10 +367,34 @@ namespace blt
};
template<typename T, typename E>
class expected<T, E, false> : public expected<T, E, true>
class expected<T, E, true, true> : public expected<T, E, true, false>
{
public:
using expected<T, E, true>::expected;
using expected<T, E, true, false>::expected;
constexpr expected() noexcept: expected<T, E, std::is_copy_constructible_v<T>, false>(T())
{}
};
template<typename T, typename E>
class expected<T, E, false, true> : public expected<T, E, true, false>
{
public:
using expected<T, E, true, false>::expected;
constexpr expected() noexcept: expected<T, E, std::is_copy_constructible_v<T>, false>(T())
{}
constexpr expected(const expected<T, E, false>& copy) = delete;
expected& operator=(const expected& copy) = delete;
};
template<typename T, typename E>
class expected<T, E, false, false> : public expected<T, E, true, false>
{
public:
using expected<T, E, true, false>::expected;
constexpr expected(const expected<T, E, false>& copy) = delete;

@ -1 +1 @@
Subproject commit d88c5e15079047777b418132ece5879e7c9aaa2b
Subproject commit 8a889d3699b3c09ade435641fb034427f3fd12b6