diff --git a/doc/nvp.qbk b/doc/nvp.qbk index 12abb52..3543a39 100644 --- a/doc/nvp.qbk +++ b/doc/nvp.qbk @@ -40,6 +40,7 @@ namespace boost { template class nvp { +public: nvp(const char* name, T& value) noexcept; const char* name() const noexcept; @@ -49,13 +50,7 @@ class nvp { const T& const_value() const noexcept; template - void save(A& archive, unsigned) const; - - template - void load(A& archive, unsigned); - - template - void serialize(A& archive, unsigned); + void serialize(A& archive, unsigned version); }; template @@ -80,26 +75,22 @@ const nvp make_nvp(const char* name, T& value) noexcept; [variablelist [[`const char* name() const noexcept;`] -[Returns the stored name pointer.]] +[Returns a pointer to the name.]] [[`T& value() const noexcept;`] -[Returns the stored value pointer.]] +[Returns a reference to the value.]] [[`const T& const_value() const noexcept;`] -[Returns the stored value pointer.]] -[[`template void save(A& archive, unsigned) const;`] -[Calls `archive.operator<<(const_value())`.]] -[[`template void load(A& archive, unsigned);`] -[Calls `archive.operator>>(value())`.]] +[Returns a reference to the value.]] [[`template void serialize(A& archive, unsigned version);`] -[Calls `save(archive, version)` if `A::is_saving` is a true type, -otherwise `load(archive, version)`.]]] +[Calls `archive.operator<<(const_value())` if `A::is_saving` is a true type, +otherwise `archive.operator>>(value())`.]]] [endsect] [section Traits] [variablelist -[[`template class is_nvp;`] +[[`template struct is_nvp;`] [Provides static constant `value` equal to true if `T` is an NVP type, otherwise false.]]] @@ -118,7 +109,7 @@ noexcept;`] [section Acknowledgments] -Robert Ramey originally implemented nvp in the Serialization library. Glen +Robert Ramey originally implemented NVP in the Serialization library. Glen Fernandes implemented this new (but compatible) version in the Core library. [endsect] diff --git a/include/boost/core/nvp.hpp b/include/boost/core/nvp.hpp index d61a533..168e845 100644 --- a/include/boost/core/nvp.hpp +++ b/include/boost/core/nvp.hpp @@ -51,16 +51,6 @@ public: return *v_; } - template - void save(A& a, unsigned) const { - a.operator<<(*v_); - } - - template - void load(A& a, unsigned) { - a.operator>>(*v_); - } - template void serialize(A& a, unsigned) { archive(a, detail::nvp_bool()); diff --git a/test/nvp_test.cpp b/test/nvp_test.cpp index 6c2e29b..b96cdb0 100644 --- a/test/nvp_test.cpp +++ b/test/nvp_test.cpp @@ -56,24 +56,6 @@ void test() BOOST_TEST_EQ(&p.value(), &v); } -void test_save() -{ - int v = 1; - boost::nvp p("name", v); - saver s(0); - p.save(s, unsigned()); - BOOST_TEST_EQ(s.get(), 1); -} - -void test_load() -{ - int v = 1; - boost::nvp p("name", v); - loader l(5); - p.load(l, unsigned()); - BOOST_TEST_EQ(p.value(), 5); -} - void test_serialize() { int v = 1; @@ -117,8 +99,6 @@ void test_factory() int main() { test(); - test_save(); - test_load(); test_serialize(); test_deserialize(); test_trait();