mirror of
https://github.com/boostorg/core.git
synced 2025-07-29 12:27:42 +02:00
Add a definition for nvp_bool
This commit is contained in:
@ -50,7 +50,7 @@ public:
|
||||
const T& const_value() const noexcept;
|
||||
|
||||
template<class A>
|
||||
void serialize(A& archive, unsigned version);
|
||||
void serialize(A& archive, unsigned);
|
||||
};
|
||||
|
||||
template<class T>
|
||||
@ -80,8 +80,7 @@ const nvp<T> make_nvp(const char* name, T& value) noexcept;
|
||||
[Returns a reference to the value.]]
|
||||
[[`const T& const_value() const noexcept;`]
|
||||
[Returns a reference to the value.]]
|
||||
[[`template<class A> void serialize(A& archive,
|
||||
unsigned version);`]
|
||||
[[`template<class A> void serialize(A& archive, unsigned);`]
|
||||
[Calls `archive.operator<<(const_value())` if `A::is_saving` is a true type,
|
||||
otherwise `archive.operator>>(value())`.]]]
|
||||
|
||||
|
@ -19,7 +19,7 @@ struct nvp_bool {
|
||||
typedef bool value_type;
|
||||
typedef nvp_bool type;
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool, value = V);
|
||||
BOOST_STATIC_CONSTEXPR bool value = V;
|
||||
|
||||
BOOST_CONSTEXPR operator bool() const BOOST_NOEXCEPT {
|
||||
return V;
|
||||
@ -30,6 +30,9 @@ struct nvp_bool {
|
||||
}
|
||||
};
|
||||
|
||||
template<bool V>
|
||||
BOOST_CONSTEXPR_OR_CONST bool nvp_bool<V>::value;
|
||||
|
||||
} /* detail */
|
||||
|
||||
template<class T>
|
||||
|
@ -76,14 +76,11 @@ void test_deserialize()
|
||||
|
||||
void test_trait()
|
||||
{
|
||||
BOOST_TEST_TRAIT_TRUE((boost::is_nvp<boost::nvp<int> >));
|
||||
BOOST_TEST_TRAIT_FALSE((boost::is_nvp<int>));
|
||||
BOOST_TEST_TRAIT_TRUE((boost::is_nvp<boost::nvp<int> >));
|
||||
BOOST_TEST_TRAIT_TRUE((boost::is_nvp<const boost::nvp<int> >));
|
||||
BOOST_TEST_TRAIT_FALSE((boost::is_nvp<const int>));
|
||||
BOOST_TEST_TRAIT_TRUE((boost::is_nvp<volatile boost::nvp<int> >));
|
||||
BOOST_TEST_TRAIT_FALSE((boost::is_nvp<volatile int>));
|
||||
BOOST_TEST_TRAIT_TRUE((boost::is_nvp<const volatile boost::nvp<int> >));
|
||||
BOOST_TEST_TRAIT_FALSE((boost::is_nvp<const volatile int>));
|
||||
}
|
||||
|
||||
void test_factory()
|
||||
|
Reference in New Issue
Block a user