mirror of
https://github.com/boostorg/core.git
synced 2025-07-31 05:17:22 +02:00
Update nvp tests and documentation
This commit is contained in:
24
doc/nvp.qbk
24
doc/nvp.qbk
@ -24,8 +24,8 @@ Serialization library.
|
|||||||
The following snippet shows use in a member serialize function:
|
The following snippet shows use in a member serialize function:
|
||||||
|
|
||||||
```
|
```
|
||||||
template<class Archive>
|
template<class A>
|
||||||
void serialize(Archive& archive, unsigned)
|
void serialize(A& archive, unsigned)
|
||||||
{
|
{
|
||||||
archive & boost::make_nvp("x", x_) & boost::make_nvp("y", y_);
|
archive & boost::make_nvp("x", x_) & boost::make_nvp("y", y_);
|
||||||
}
|
}
|
||||||
@ -48,14 +48,14 @@ class nvp {
|
|||||||
|
|
||||||
const T& const_value() const noexcept;
|
const T& const_value() const noexcept;
|
||||||
|
|
||||||
template<class Archive>
|
template<class A>
|
||||||
void save(Archive& archive, unsigned) const;
|
void save(A& archive, unsigned) const;
|
||||||
|
|
||||||
template<class Archive>
|
template<class A>
|
||||||
void load(Archive& archive, unsigned);
|
void load(A& archive, unsigned);
|
||||||
|
|
||||||
template<class Archive>
|
template<class A>
|
||||||
void serialize(Archive& archive, unsigned);
|
void serialize(A& archive, unsigned);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@ -85,13 +85,13 @@ const nvp<T> make_nvp(const char* name, T& value) noexcept;
|
|||||||
[Returns the stored value pointer.]]
|
[Returns the stored value pointer.]]
|
||||||
[[`const T& const_value() const noexcept;`]
|
[[`const T& const_value() const noexcept;`]
|
||||||
[Returns the stored value pointer.]]
|
[Returns the stored value pointer.]]
|
||||||
[[`template<class Archive> void save(Archvie& archive, unsigned) const;`]
|
[[`template<class A> void save(A& archive, unsigned) const;`]
|
||||||
[Calls `archive.operator<<(const_value())`.]]
|
[Calls `archive.operator<<(const_value())`.]]
|
||||||
[[`template<class Archive> void load(Archvie& archive, unsigned);`]
|
[[`template<class A> void load(A& archive, unsigned);`]
|
||||||
[Calls `archive.operator>>(value())`.]]
|
[Calls `archive.operator>>(value())`.]]
|
||||||
[[`template<class Archive> void serialize(Archvie& archive,
|
[[`template<class A> void serialize(A& archive,
|
||||||
unsigned version);`]
|
unsigned version);`]
|
||||||
[Calls `save(archive, version)` if `Archive::is_saving` is a true type,
|
[Calls `save(archive, version)` if `A::is_saving` is a true type,
|
||||||
otherwise `load(archive, version)`.]]]
|
otherwise `load(archive, version)`.]]]
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
@ -94,10 +94,14 @@ void test_deserialize()
|
|||||||
|
|
||||||
void test_trait()
|
void test_trait()
|
||||||
{
|
{
|
||||||
BOOST_TEST_TRAIT_TRUE((boost::is_nvp<boost::nvp<double> >));
|
BOOST_TEST_TRAIT_TRUE((boost::is_nvp<boost::nvp<int> >));
|
||||||
BOOST_TEST_TRAIT_FALSE((boost::is_nvp<double>));
|
BOOST_TEST_TRAIT_FALSE((boost::is_nvp<int>));
|
||||||
BOOST_TEST_TRAIT_TRUE((boost::is_nvp<const 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_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()
|
void test_factory()
|
||||||
|
Reference in New Issue
Block a user