fix expected on clang
parent
6f06647a21
commit
627f8022f2
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.20)
|
||||
include(cmake/color.cmake)
|
||||
set(BLT_VERSION 0.18.32)
|
||||
set(BLT_VERSION 0.18.33)
|
||||
set(BLT_TEST_VERSION 0.0.1)
|
||||
|
||||
set(BLT_TARGET BLT)
|
||||
|
|
|
@ -113,7 +113,7 @@ namespace blt
|
|||
|
||||
};
|
||||
|
||||
template<typename T, typename E, bool = std::is_copy_constructible_v<T>, bool = std::is_default_constructible_v<T>>
|
||||
template<typename T, typename E, bool = std::is_copy_constructible_v<T>>
|
||||
class expected
|
||||
{
|
||||
protected:
|
||||
|
@ -131,8 +131,16 @@ 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 G, std::enable_if_t<std::is_default_constructible_v<G> && std::is_convertible_v<G, T>, bool> = true>
|
||||
constexpr expected(): v(G{})
|
||||
{}
|
||||
|
||||
// template<typename H, std::enable_if_t<!std::is_default_constructible_v<T> && std::is_default_constructible_v<E> && std::is_convertible_v<H, E>, bool> = true>
|
||||
// constexpr expected(): v(H{})
|
||||
// {}
|
||||
|
||||
// constexpr expected(const expected& copy) = delete;
|
||||
constexpr expected(const expected<T, E, true>& copy): expected<T, E, true>::v(copy.v)
|
||||
constexpr expected(const expected<T, E, true>& copy): expected<T, E, true>::v(copy.v) // NOLINT
|
||||
{}
|
||||
|
||||
expected& operator=(const expected& copy)
|
||||
|
@ -173,7 +181,7 @@ namespace blt
|
|||
(std::is_convertible_v<UF, T> && std::is_convertible_v<GF, E>) && (std::is_constructible_v<T, UF> || std::is_void_v<U>) &&
|
||||
std::is_constructible_v<E, GF> && !eight_insanity_v<U, G> && !four_insanity_v<U, G>, bool> = true>
|
||||
|
||||
constexpr expected(const expected<U, G>& other):
|
||||
constexpr expected(const expected<U, G>& other): // NOLINT
|
||||
v(other.has_value() ? std::forward<UF>(*other) : std::forward<GF>(other.error()))
|
||||
{}
|
||||
|
||||
|
@ -181,7 +189,7 @@ namespace blt
|
|||
(std::is_convertible_v<UF, T> && std::is_convertible_v<GF, E>) && (std::is_constructible_v<T, UF> || std::is_void_v<U>) &&
|
||||
std::is_constructible_v<E, GF> && !eight_insanity_v<U, G> && !four_insanity_v<U, G>, bool> = true>
|
||||
|
||||
constexpr expected(expected<U, G>&& other):
|
||||
constexpr expected(expected<U, G>&& other): // NOLINT
|
||||
v(other.has_value() ? std::forward<UF>(*other) : std::forward<GF>(other.error()))
|
||||
{}
|
||||
|
||||
|
@ -207,7 +215,7 @@ namespace blt
|
|||
std::is_constructible_v<T, U> &&
|
||||
!std::is_same_v<remove_cvref_t<U>, unexpected<U>> &&
|
||||
!std::is_same_v<remove_cvref_t<U>, expected<T, E>>, bool> = true>
|
||||
constexpr expected(U&& v): v(T(std::forward<U>(v)))
|
||||
constexpr expected(U&& v): v(T(std::forward<U>(v))) // NOLINT
|
||||
{}
|
||||
|
||||
/*
|
||||
|
@ -221,7 +229,7 @@ namespace blt
|
|||
|
||||
template<class G, class GF = std::add_const_t<std::add_lvalue_reference_t<G>>, std::enable_if_t<
|
||||
std::is_convertible_v<const G&, E> && std::is_constructible_v<E, GF>, bool> = true>
|
||||
constexpr expected(const unexpected<G>& e): v(std::forward<GF>(e.error()))
|
||||
constexpr expected(const unexpected<G>& e): v(std::forward<GF>(e.error())) // NOLINT
|
||||
{}
|
||||
|
||||
/*
|
||||
|
@ -235,7 +243,7 @@ namespace blt
|
|||
|
||||
template<class G, class GF = std::add_const_t<std::add_lvalue_reference_t<G>>, std::enable_if_t<
|
||||
std::is_convertible_v<G, E> && std::is_constructible_v<E, GF>, bool> = true>
|
||||
constexpr expected(unexpected<G>&& e): v(std::forward<GF>(e.error()))
|
||||
constexpr expected(unexpected<G>&& e): v(std::forward<GF>(e.error())) // NOLINT
|
||||
{}
|
||||
|
||||
/*
|
||||
|
@ -367,34 +375,10 @@ namespace blt
|
|||
};
|
||||
|
||||
template<typename T, typename E>
|
||||
class expected<T, E, true, true> : public expected<T, E, true, false>
|
||||
class expected<T, E, false>
|
||||
{
|
||||
public:
|
||||
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;
|
||||
using expected<T, E, true>::expected;
|
||||
|
||||
constexpr expected(const expected<T, E, false>& copy) = delete;
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 8a889d3699b3c09ade435641fb034427f3fd12b6
|
||||
Subproject commit d88c5e15079047777b418132ece5879e7c9aaa2b
|
|
@ -19,15 +19,9 @@ namespace blt
|
|||
* --------------------------
|
||||
*/
|
||||
|
||||
#define SORT_INTERVALS_FUNC_MACRO(use_history, TYPE_END, TYPE_START, TYPE_TOTAL) \
|
||||
[&use_history](const interval_t* a, const interval_t* b) -> bool { \
|
||||
/*if (!use_history){ \
|
||||
auto a_diff = a->TYPE_END - a->TYPE_START; \
|
||||
auto b_diff = b->TYPE_END - b->TYPE_START; \
|
||||
return a_diff > b_diff; \
|
||||
} else { \
|
||||
*/return a->TYPE_TOTAL < b->TYPE_TOTAL; \
|
||||
/*}*/ \
|
||||
#define SORT_INTERVALS_FUNC_MACRO(TYPE_END, TYPE_START, TYPE_TOTAL) \
|
||||
[](const interval_t* a, const interval_t* b) -> bool { \
|
||||
return a->TYPE_TOTAL < b->TYPE_TOTAL; \
|
||||
}
|
||||
|
||||
#define INTERVAL_DIFFERENCE_MACRO(printHistory, interval) \
|
||||
|
@ -100,19 +94,19 @@ namespace blt
|
|||
BLT_WARN("Write profile for V2 is currently a TODO");
|
||||
}
|
||||
|
||||
void sort_intervals(std::vector<interval_t*>& intervals, sort_by sort, bool use_history)
|
||||
void sort_intervals(std::vector<interval_t*>& intervals, sort_by sort, bool)
|
||||
{
|
||||
std::function<bool(const interval_t* a, const interval_t* b)> sort_func;
|
||||
switch (sort)
|
||||
{
|
||||
case sort_by::CYCLES:
|
||||
sort_func = SORT_INTERVALS_FUNC_MACRO(use_history, cycles_start, cycles_end, cycles_total);
|
||||
sort_func = SORT_INTERVALS_FUNC_MACRO(cycles_start, cycles_end, cycles_total);
|
||||
break;
|
||||
case sort_by::WALL:
|
||||
sort_func = SORT_INTERVALS_FUNC_MACRO(use_history, wall_start, wall_end, wall_total);
|
||||
sort_func = SORT_INTERVALS_FUNC_MACRO(wall_start, wall_end, wall_total);
|
||||
break;
|
||||
case sort_by::THREAD:
|
||||
sort_func = SORT_INTERVALS_FUNC_MACRO(use_history, thread_start, thread_end, thread_total);
|
||||
sort_func = SORT_INTERVALS_FUNC_MACRO(thread_start, thread_end, thread_total);
|
||||
break;
|
||||
}
|
||||
std::sort(intervals.begin(), intervals.end(), sort_func);
|
||||
|
|
Loading…
Reference in New Issue