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(args)...) {} - // template , variant_t>, bool> = true> - // explicit constexpr variant_t(T&& t): m_variant(std::forward(t)) - // {} - - // template - // constexpr variant_t(std::initializer_list il): m_variant(*il.begin()) - // { - // } - template explicit constexpr variant_t(std::in_place_type_t, C_Args&&... args): m_variant(std::in_place_type, std::forward(args)...) {} @@ -208,8 +199,15 @@ namespace blt return m_variant.valueless_by_exception(); } - template - static constexpr auto make_visitor(Visitee&& visitees) + template ...> || std::conjunction_v< + std::is_invocable...>, bool> = true> + constexpr auto visit(T&& visitor) -> decltype(auto) + { + return std::visit(std::forward(visitor), m_variant); + } + + template + 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>; @@ -225,8 +223,7 @@ namespace blt return typename meta_t::return_type{}; } else { - return typename meta_t::return_type( - std::forward(visitees)(std::forward(value))); + return typename meta_t::return_type(std::forward(visitees)(std::forward(value))); } }... }; @@ -247,8 +244,7 @@ namespace blt } else { return typename meta_t::return_type( - typename meta_t::base_type( - std::forward(visitees)(std::forward(value)))); + typename meta_t::base_type(std::forward(visitees)(std::forward(value)))); } }... }; @@ -256,9 +252,7 @@ namespace blt { return lambda_visitor{ [&](std::tuple_element_t<0, typename meta::function_like::args_tuple> value) { - return typename meta_t::return_type{ - std::forward(visitees)(std::forward(value)) - }; + return typename meta_t::return_type{std::forward(visitees)(std::forward(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 . */ -#include #include #include +#include struct base_type {