Add BOOST_NVP convenience macro

This commit is contained in:
Glen Fernandes
2019-09-16 02:01:05 -04:00
parent 7cc1047ab7
commit 0591b1d855
3 changed files with 23 additions and 1 deletions

View File

@@ -6,7 +6,7 @@ Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#include <boost/core/nvp.hpp>
#include <boost/core/lightweight_test_trait.hpp>
#include <boost/core/lightweight_test.hpp>
void test()
{
@@ -28,9 +28,19 @@ void test_factory()
BOOST_TEST_EQ(&p.value(), &v);
}
void test_macro()
{
int v = 1;
boost::nvp<int> p = BOOST_NVP(v);
BOOST_TEST_CSTR_EQ(p.name(), "v");
BOOST_TEST_EQ(p.value(), 1);
BOOST_TEST_EQ(&p.value(), &v);
}
int main()
{
test();
test_factory();
test_macro();
return boost::report_errors();
}