From cfaf8713ea0f02bcd325bf0d5c326df5215c6287 Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Sun, 11 Jan 2026 22:36:59 +0300 Subject: [PATCH] Simpilfy code --- include/boost/any/basic_any.hpp | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/include/boost/any/basic_any.hpp b/include/boost/any/basic_any.hpp index 20cab2f..992a072 100644 --- a/include/boost/any/basic_any.hpp +++ b/include/boost/any/basic_any.hpp @@ -172,28 +172,10 @@ BOOST_ANY_BEGIN_MODULE_EXPORT std::is_nothrow_move_constructible::value> {}; - template - static void create(basic_any& any, const ValueType& value, std::true_type) - { - using DecayedType = typename std::decay::type; - - any.man = &small_manager; - new (&any.content.small_value) ValueType(value); - } - - template - static void create(basic_any& any, const ValueType& value, std::false_type) - { - using DecayedType = typename std::decay::type; - - any.man = &large_manager; - any.content.large_value = new DecayedType(value); - } - template static void create(basic_any& any, ValueType&& value, std::true_type) { - using DecayedType = typename std::decay::type; + using DecayedType = typename std::decay::type; any.man = &small_manager; new (&any.content.small_value) DecayedType(std::forward(value)); } @@ -201,15 +183,15 @@ BOOST_ANY_BEGIN_MODULE_EXPORT template static void create(basic_any& any, ValueType&& value, std::false_type) { - using DecayedType = typename std::decay::type; + using DecayedType = typename std::decay::type; any.man = &large_manager; any.content.large_value = new DecayedType(std::forward(value)); } /// @endcond public: // non-type template parameters accessors - static constexpr std::size_t buffer_size = OptimizeForSize; - static constexpr std::size_t buffer_align = OptimizeForAlignment; + static constexpr std::size_t buffer_size = OptimizeForSize; + static constexpr std::size_t buffer_align = OptimizeForAlignment; public: // structors