Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:30

0001 /*
0002 Copyright 2019 Glen Joseph Fernandes
0003 (glenjofe@gmail.com)
0004 
0005 Distributed under the Boost Software License, Version 1.0.
0006 (http://www.boost.org/LICENSE_1_0.txt)
0007 */
0008 #ifndef BOOST_CORE_NVP_HPP
0009 #define BOOST_CORE_NVP_HPP
0010 
0011 #include <boost/core/addressof.hpp>
0012 #include <boost/config.hpp>
0013 
0014 namespace boost {
0015 namespace serialization {
0016 
0017 template<class T>
0018 class nvp {
0019 public:
0020     nvp(const char* n, T& v) BOOST_NOEXCEPT
0021         : n_(n)
0022         , v_(boost::addressof(v)) { }
0023 
0024     const char* name() const BOOST_NOEXCEPT {
0025         return n_;
0026     }
0027 
0028     T& value() const BOOST_NOEXCEPT {
0029         return *v_;
0030     }
0031 
0032     const T& const_value() const BOOST_NOEXCEPT {
0033         return *v_;
0034     }
0035 
0036 private:
0037     const char* n_;
0038     T* v_;
0039 };
0040 
0041 template<class T>
0042 inline const nvp<T>
0043 make_nvp(const char* n, T& v) BOOST_NOEXCEPT
0044 {
0045     return nvp<T>(n, v);
0046 }
0047 
0048 } /* serialization */
0049 
0050 using serialization::nvp;
0051 using serialization::make_nvp;
0052 
0053 } /* boost */
0054 
0055 #define BOOST_NVP(v) boost::make_nvp(BOOST_STRINGIZE(v), v)
0056 
0057 #endif