File indexing completed on 2025-12-15 10:08:14
0001 #ifndef BOOST_SERIALIZATION_STRONG_TYPEDEF_HPP
0002 #define BOOST_SERIALIZATION_STRONG_TYPEDEF_HPP
0003
0004
0005 #if defined(_MSC_VER)
0006 # pragma once
0007 #endif
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #include <boost/config.hpp>
0027 #include <boost/operators.hpp>
0028 #include <boost/type_traits/has_nothrow_assign.hpp>
0029 #include <boost/type_traits/has_nothrow_constructor.hpp>
0030 #include <boost/type_traits/has_nothrow_copy.hpp>
0031
0032 #define BOOST_STRONG_TYPEDEF(T, D) \
0033 struct D \
0034 : boost::totally_ordered1< D \
0035 , boost::totally_ordered2< D, T \
0036 > > \
0037 { \
0038 T t; \
0039 explicit D(const T& t_) BOOST_NOEXCEPT_IF(boost::has_nothrow_copy_constructor<T>::value) : t(t_) {} \
0040 D() BOOST_NOEXCEPT_IF(boost::has_nothrow_default_constructor<T>::value) : t() {} \
0041 D(const D & t_) BOOST_NOEXCEPT_IF(boost::has_nothrow_copy_constructor<T>::value) : t(t_.t) {} \
0042 D& operator=(const D& rhs) BOOST_NOEXCEPT_IF(boost::has_nothrow_assign<T>::value) {t = rhs.t; return *this;} \
0043 D& operator=(const T& rhs) BOOST_NOEXCEPT_IF(boost::has_nothrow_assign<T>::value) {t = rhs; return *this;} \
0044 operator const T&() const {return t;} \
0045 operator T&() {return t;} \
0046 bool operator==(const D& rhs) const {return t == rhs.t;} \
0047 bool operator<(const D& rhs) const {return t < rhs.t;} \
0048 };
0049
0050 #endif