Update bool constant

This commit is contained in:
Glen Fernandes
2021-12-06 23:25:32 -05:00
parent 0c9675cf56
commit 85a3183c01
2 changed files with 14 additions and 10 deletions

View File

@ -241,7 +241,7 @@ namespace detail {
template<bool V> template<bool V>
struct alloc_bool { struct alloc_bool {
typedef bool value_type; typedef bool value_type;
typedef alloc_bool<V> type; typedef alloc_bool type;
static const bool value = V; static const bool value = V;

View File

@ -19,21 +19,25 @@ BOOST_NORETURN void throw_exception(const std::exception&);
namespace default_ { namespace default_ {
struct true_type { template<bool V>
struct bool_constant {
typedef bool value_type; 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 { operator bool() const BOOST_NOEXCEPT {
return true; return V;
} }
BOOST_CONSTEXPR bool operator()() const BOOST_NOEXCEPT { bool operator()() const BOOST_NOEXCEPT {
return true; return V;
} }
}; };
template<bool V>
const bool bool_constant<V>::value;
template<class T> template<class T>
struct add_reference { struct add_reference {
typedef T& type; typedef T& type;
@ -58,8 +62,8 @@ struct default_allocator {
typedef typename add_reference<const T>::type const_reference; typedef typename add_reference<const T>::type const_reference;
typedef std::size_t size_type; typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type; typedef std::ptrdiff_t difference_type;
typedef true_type propagate_on_container_move_assignment; typedef bool_constant<true> propagate_on_container_move_assignment;
typedef true_type is_always_equal; typedef bool_constant<true> is_always_equal;
template<class U> template<class U>
struct rebind { struct rebind {