From 5981a244c286f6e60dcd7954cde533fe48e4e998 Mon Sep 17 00:00:00 2001 From: Brett <brettmaster1@gmail.com> Date: Sat, 26 Apr 2025 00:40:39 -0400 Subject: [PATCH] nope --- CMakeLists.txt | 2 +- include/blt/std/variant.h | 30 ++++++++++++------------------ libraries/parallel-hashmap | 2 +- tests/variant_tests.cpp | 2 +- 4 files changed, 15 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 13f9e82..78add7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.20) include(cmake/color.cmake) -set(BLT_VERSION 5.4.12) +set(BLT_VERSION 5.4.13) set(BLT_TARGET BLT) diff --git a/include/blt/std/variant.h b/include/blt/std/variant.h index e4dfefd..85cde6a 100644 --- a/include/blt/std/variant.h +++ b/include/blt/std/variant.h @@ -147,15 +147,6 @@ namespace blt std::forward<Types>(args)...) {} - // template <typename T, std::enable_if_t<!std::is_same_v<std::decay_t<T>, variant_t>, bool> = true> - // explicit constexpr variant_t(T&& t): m_variant(std::forward<T>(t)) - // {} - - // template<typename T> - // constexpr variant_t(std::initializer_list<T> il): m_variant(*il.begin()) - // { - // } - template <typename T, typename... C_Args> explicit constexpr variant_t(std::in_place_type_t<T>, C_Args&&... args): m_variant(std::in_place_type<T>, std::forward<C_Args>(args)...) {} @@ -208,8 +199,15 @@ namespace blt return m_variant.valueless_by_exception(); } - template<typename... Visitee> - static constexpr auto make_visitor(Visitee&& visitees) + template <typename T, std::enable_if_t<std::conjunction_v<std::is_invocable<decltype(&T::operator()), T, Types>...> || std::conjunction_v< + std::is_invocable<decltype(&T::operator()), Types>...>, bool> = true> + constexpr auto visit(T&& visitor) -> decltype(auto) + { + return std::visit(std::forward<T>(visitor), m_variant); + } + + template <typename... Visitee> + static constexpr auto make_visitor(Visitee&&... visitees) { // TODO: this is probably not the best way to handle these cases... using meta_t = detail::visit_return_type<std::tuple<Visitee...>, std::tuple<Types...>>; @@ -225,8 +223,7 @@ namespace blt return typename meta_t::return_type{}; } else { - return typename meta_t::return_type( - std::forward<Visitee>(visitees)(std::forward<decltype(value)>(value))); + return typename meta_t::return_type(std::forward<Visitee>(visitees)(std::forward<decltype(value)>(value))); } }... }; @@ -247,8 +244,7 @@ namespace blt } else { return typename meta_t::return_type( - typename meta_t::base_type( - std::forward<Visitee>(visitees)(std::forward<decltype(value)>(value)))); + typename meta_t::base_type(std::forward<Visitee>(visitees)(std::forward<decltype(value)>(value)))); } }... }; @@ -256,9 +252,7 @@ namespace blt { return lambda_visitor{ [&](std::tuple_element_t<0, typename meta::function_like<Visitee>::args_tuple> value) { - return typename meta_t::return_type{ - std::forward<Visitee>(visitees)(std::forward<decltype(value)>(value)) - }; + return typename meta_t::return_type{std::forward<Visitee>(visitees)(std::forward<decltype(value)>(value))}; }... }; } diff --git a/libraries/parallel-hashmap b/libraries/parallel-hashmap index 7ef2e73..93201da 160000 --- a/libraries/parallel-hashmap +++ b/libraries/parallel-hashmap @@ -1 +1 @@ -Subproject commit 7ef2e733416953b222851f9a360d7fc72d068ee5 +Subproject commit 93201da2ba5a6aba0a6e57ada64973555629b3e3 diff --git a/tests/variant_tests.cpp b/tests/variant_tests.cpp index 0d8917f..67b62eb 100644 --- a/tests/variant_tests.cpp +++ b/tests/variant_tests.cpp @@ -15,9 +15,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -#include <blt/std/variant.h> #include <blt/logging/logging.h> #include <blt/std/assert.h> +#include <blt/std/variant.h> struct base_type {