From 627f8022f29e8190a621c0b03f9303c279423adc Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Fri, 16 Aug 2024 18:00:28 -0400 Subject: [PATCH] fix expected on clang --- CMakeLists.txt | 2 +- include/blt/std/expected.h | 50 +++++++++++-------------------- libraries/parallel-hashmap | 2 +- src/blt/profiling/profiler_v2.cpp | 20 +++++-------- 4 files changed, 26 insertions(+), 48 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fedec3b..b040bc2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/include/blt/std/expected.h b/include/blt/std/expected.h index bf42cd4..f45dcb5 100644 --- a/include/blt/std/expected.h +++ b/include/blt/std/expected.h @@ -113,7 +113,7 @@ namespace blt }; - template, bool = std::is_default_constructible_v> + template> class expected { protected: @@ -131,8 +131,16 @@ namespace blt std::is_constructible_v, expected&> || std::is_constructible_v, expected> || std::is_constructible_v, const expected&> || std::is_constructible_v, const expected>; public: + template && std::is_convertible_v, bool> = true> + constexpr expected(): v(G{}) + {} + +// template && std::is_default_constructible_v && std::is_convertible_v, bool> = true> +// constexpr expected(): v(H{}) +// {} + // constexpr expected(const expected& copy) = delete; - constexpr expected(const expected& copy): expected::v(copy.v) + constexpr expected(const expected& copy): expected::v(copy.v) // NOLINT {} expected& operator=(const expected& copy) @@ -173,7 +181,7 @@ namespace blt (std::is_convertible_v && std::is_convertible_v) && (std::is_constructible_v || std::is_void_v) && std::is_constructible_v && !eight_insanity_v && !four_insanity_v, bool> = true> - constexpr expected(const expected& other): + constexpr expected(const expected& other): // NOLINT v(other.has_value() ? std::forward(*other) : std::forward(other.error())) {} @@ -181,7 +189,7 @@ namespace blt (std::is_convertible_v && std::is_convertible_v) && (std::is_constructible_v || std::is_void_v) && std::is_constructible_v && !eight_insanity_v && !four_insanity_v, bool> = true> - constexpr expected(expected&& other): + constexpr expected(expected&& other): // NOLINT v(other.has_value() ? std::forward(*other) : std::forward(other.error())) {} @@ -207,7 +215,7 @@ namespace blt std::is_constructible_v && !std::is_same_v, unexpected> && !std::is_same_v, expected>, bool> = true> - constexpr expected(U&& v): v(T(std::forward(v))) + constexpr expected(U&& v): v(T(std::forward(v))) // NOLINT {} /* @@ -221,7 +229,7 @@ namespace blt template>, std::enable_if_t< std::is_convertible_v && std::is_constructible_v, bool> = true> - constexpr expected(const unexpected& e): v(std::forward(e.error())) + constexpr expected(const unexpected& e): v(std::forward(e.error())) // NOLINT {} /* @@ -235,7 +243,7 @@ namespace blt template>, std::enable_if_t< std::is_convertible_v && std::is_constructible_v, bool> = true> - constexpr expected(unexpected&& e): v(std::forward(e.error())) + constexpr expected(unexpected&& e): v(std::forward(e.error())) // NOLINT {} /* @@ -367,34 +375,10 @@ namespace blt }; template - class expected : public expected + class expected { public: - using expected::expected; - - constexpr expected() noexcept: expected, false>(T()) - {} - }; - - template - class expected : public expected - { - public: - using expected::expected; - - constexpr expected() noexcept: expected, false>(T()) - {} - - constexpr expected(const expected& copy) = delete; - - expected& operator=(const expected& copy) = delete; - }; - - template - class expected : public expected - { - public: - using expected::expected; + using expected::expected; constexpr expected(const expected& copy) = delete; diff --git a/libraries/parallel-hashmap b/libraries/parallel-hashmap index 8a889d3..d88c5e1 160000 --- a/libraries/parallel-hashmap +++ b/libraries/parallel-hashmap @@ -1 +1 @@ -Subproject commit 8a889d3699b3c09ade435641fb034427f3fd12b6 +Subproject commit d88c5e15079047777b418132ece5879e7c9aaa2b diff --git a/src/blt/profiling/profiler_v2.cpp b/src/blt/profiling/profiler_v2.cpp index ff5e55d..eb45b58 100644 --- a/src/blt/profiling/profiler_v2.cpp +++ b/src/blt/profiling/profiler_v2.cpp @@ -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& intervals, sort_by sort, bool use_history) + void sort_intervals(std::vector& intervals, sort_by sort, bool) { std::function 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);