From 85a3183c01e2ceb2d98f026b8e1d0f3f601d9829 Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Mon, 6 Dec 2021 23:25:32 -0500 Subject: [PATCH] Update bool constant --- include/boost/core/allocator_access.hpp | 2 +- include/boost/core/default_allocator.hpp | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/include/boost/core/allocator_access.hpp b/include/boost/core/allocator_access.hpp index fab7474..9dc4017 100644 --- a/include/boost/core/allocator_access.hpp +++ b/include/boost/core/allocator_access.hpp @@ -241,7 +241,7 @@ namespace detail { template struct alloc_bool { typedef bool value_type; - typedef alloc_bool type; + typedef alloc_bool type; static const bool value = V; diff --git a/include/boost/core/default_allocator.hpp b/include/boost/core/default_allocator.hpp index ba8540b..91d3bbc 100644 --- a/include/boost/core/default_allocator.hpp +++ b/include/boost/core/default_allocator.hpp @@ -19,21 +19,25 @@ BOOST_NORETURN void throw_exception(const std::exception&); namespace default_ { -struct true_type { +template +struct bool_constant { typedef bool value_type; - typedef true_type type; + typedef bool_constant type; - BOOST_STATIC_CONSTANT(bool, value = true); + static const bool value = V; - BOOST_CONSTEXPR operator bool() const BOOST_NOEXCEPT { - return true; + operator bool() const BOOST_NOEXCEPT { + return V; } - BOOST_CONSTEXPR bool operator()() const BOOST_NOEXCEPT { - return true; + bool operator()() const BOOST_NOEXCEPT { + return V; } }; +template +const bool bool_constant::value; + template struct add_reference { typedef T& type; @@ -58,8 +62,8 @@ struct default_allocator { typedef typename add_reference::type const_reference; typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; - typedef true_type propagate_on_container_move_assignment; - typedef true_type is_always_equal; + typedef bool_constant propagate_on_container_move_assignment; + typedef bool_constant is_always_equal; template struct rebind {