diff --git a/include/boost/endian/buffers.hpp b/include/boost/endian/buffers.hpp index bca3dc7..fb349c8 100644 --- a/include/boost/endian/buffers.hpp +++ b/include/boost/endian/buffers.hpp @@ -37,9 +37,6 @@ #include #include #include -#define BOOST_ENDIAN_MINIMAL_COVER_OPERATORS -#include -#undef BOOST_ENDIAN_MINIMAL_COVER_OPERATORS #include #include #include @@ -61,12 +58,6 @@ # define BOOST_ENDIAN_NO_CTORS # endif -# ifndef BOOST_ENDIAN_EXPLICIT_CTORS -# define BOOST_ENDIAN_EXPLICIT_OPT -# else -# define BOOST_ENDIAN_EXPLICIT_OPT explicit -# endif - //---------------------------------- synopsis ----------------------------------------// namespace boost @@ -342,7 +333,7 @@ namespace endian typedef T value_type; # ifndef BOOST_ENDIAN_NO_CTORS endian_buffer() BOOST_ENDIAN_DEFAULT_CONSTRUCT - BOOST_ENDIAN_EXPLICIT_OPT endian_buffer(T val) BOOST_NOEXCEPT + explicit endian_buffer(T val) BOOST_NOEXCEPT { # ifdef BOOST_ENDIAN_LOG if ( endian_log ) @@ -361,7 +352,7 @@ namespace endian detail::store_big_endian(m_value, val); return *this; } - operator T() const BOOST_NOEXCEPT + value_type value() const BOOST_NOEXCEPT { # ifdef BOOST_ENDIAN_LOG if ( endian_log ) @@ -383,12 +374,12 @@ namespace endian typedef float value_type; # ifndef BOOST_ENDIAN_NO_CTORS endian_buffer() BOOST_ENDIAN_DEFAULT_CONSTRUCT - BOOST_ENDIAN_EXPLICIT_OPT endian_buffer(value_type val) BOOST_NOEXCEPT + explicit endian_buffer(value_type val) BOOST_NOEXCEPT { detail::big_reverse_copy(val, m_value); } # endif endian_buffer & operator=(value_type val) BOOST_NOEXCEPT { detail::big_reverse_copy(val, m_value); return *this; } - operator value_type() const BOOST_NOEXCEPT + value_type value() const BOOST_NOEXCEPT { value_type tmp; detail::big_reverse_copy(m_value, tmp); @@ -407,12 +398,12 @@ namespace endian typedef double value_type; # ifndef BOOST_ENDIAN_NO_CTORS endian_buffer() BOOST_ENDIAN_DEFAULT_CONSTRUCT - BOOST_ENDIAN_EXPLICIT_OPT endian_buffer(value_type val) BOOST_NOEXCEPT + explicit endian_buffer(value_type val) BOOST_NOEXCEPT { detail::big_reverse_copy(val, m_value); } # endif endian_buffer & operator=(value_type val) BOOST_NOEXCEPT { detail::big_reverse_copy(val, m_value); return *this; } - operator value_type() const BOOST_NOEXCEPT + value_type value() const BOOST_NOEXCEPT { value_type tmp; detail::big_reverse_copy(m_value, tmp); @@ -431,12 +422,12 @@ namespace endian typedef float value_type; # ifndef BOOST_ENDIAN_NO_CTORS endian_buffer() BOOST_ENDIAN_DEFAULT_CONSTRUCT - BOOST_ENDIAN_EXPLICIT_OPT endian_buffer(value_type val) BOOST_NOEXCEPT + explicit endian_buffer(value_type val) BOOST_NOEXCEPT { detail::little_reverse_copy(val, m_value); } # endif endian_buffer & operator=(value_type val) BOOST_NOEXCEPT { detail::little_reverse_copy(val, m_value); return *this; } - operator value_type() const BOOST_NOEXCEPT + value_type value() const BOOST_NOEXCEPT { value_type tmp; detail::little_reverse_copy(m_value, tmp); @@ -455,12 +446,12 @@ namespace endian typedef double value_type; # ifndef BOOST_ENDIAN_NO_CTORS endian_buffer() BOOST_ENDIAN_DEFAULT_CONSTRUCT - BOOST_ENDIAN_EXPLICIT_OPT endian_buffer(value_type val) BOOST_NOEXCEPT + explicit endian_buffer(value_type val) BOOST_NOEXCEPT { detail::little_reverse_copy(val, m_value); } # endif endian_buffer & operator=(value_type val) BOOST_NOEXCEPT { detail::little_reverse_copy(val, m_value); return *this; } - operator value_type() const BOOST_NOEXCEPT + value_type value() const BOOST_NOEXCEPT { value_type tmp; detail::little_reverse_copy(m_value, tmp); @@ -480,7 +471,7 @@ namespace endian typedef T value_type; # ifndef BOOST_ENDIAN_NO_CTORS endian_buffer() BOOST_ENDIAN_DEFAULT_CONSTRUCT - BOOST_ENDIAN_EXPLICIT_OPT endian_buffer(T val) BOOST_NOEXCEPT + explicit endian_buffer(T val) BOOST_NOEXCEPT { # ifdef BOOST_ENDIAN_LOG if ( endian_log ) @@ -492,7 +483,7 @@ namespace endian # endif endian_buffer & operator=(T val) BOOST_NOEXCEPT { detail::store_little_endian(m_value, val); return *this; } - operator T() const BOOST_NOEXCEPT + value_type value() const BOOST_NOEXCEPT { # ifdef BOOST_ENDIAN_LOG if ( endian_log ) @@ -518,7 +509,7 @@ namespace endian typedef T value_type; # ifndef BOOST_ENDIAN_NO_CTORS endian_buffer() BOOST_ENDIAN_DEFAULT_CONSTRUCT - BOOST_ENDIAN_EXPLICIT_OPT endian_buffer(T val) BOOST_NOEXCEPT + explicit endian_buffer(T val) BOOST_NOEXCEPT { # ifdef BOOST_ENDIAN_LOG if ( endian_log ) @@ -534,7 +525,7 @@ namespace endian m_value = ::boost::endian::big_endian_value(val); return *this; } - operator T() const BOOST_NOEXCEPT + value_type value() const BOOST_NOEXCEPT { # ifdef BOOST_ENDIAN_LOG if ( endian_log ) @@ -559,7 +550,7 @@ namespace endian typedef T value_type; # ifndef BOOST_ENDIAN_NO_CTORS endian_buffer() BOOST_ENDIAN_DEFAULT_CONSTRUCT - BOOST_ENDIAN_EXPLICIT_OPT endian_buffer(T val) BOOST_NOEXCEPT + explicit endian_buffer(T val) BOOST_NOEXCEPT { # ifdef BOOST_ENDIAN_LOG if ( endian_log ) @@ -575,7 +566,7 @@ namespace endian m_value = ::boost::endian::little_endian_value(val); return *this; } - operator T() const BOOST_NOEXCEPT + value_type value() const BOOST_NOEXCEPT { # ifdef BOOST_ENDIAN_LOG if ( endian_log ) diff --git a/include/boost/endian/types.hpp b/include/boost/endian/types.hpp index 409ae30..c22bfab 100644 --- a/include/boost/endian/types.hpp +++ b/include/boost/endian/types.hpp @@ -37,8 +37,8 @@ #include #include #include -#define BOOST_ENDIAN_MINIMAL_COVER_OPERATORS #include +#define BOOST_ENDIAN_MINIMAL_COVER_OPERATORS #include #undef BOOST_ENDIAN_MINIMAL_COVER_OPERATORS #include @@ -263,6 +263,7 @@ namespace endian # endif endian & operator=(T val) BOOST_NOEXCEPT { detail::store_big_endian(this->m_value, val); return *this; } + operator value_type() const BOOST_NOEXCEPT { return this->value(); } }; // unaligned float big endian specialization @@ -280,6 +281,7 @@ namespace endian # endif endian & operator=(value_type val) BOOST_NOEXCEPT { detail::big_reverse_copy(val, this->m_value); return *this; } + operator value_type() const BOOST_NOEXCEPT { return this->value(); } }; // unaligned double big endian specialization @@ -297,6 +299,7 @@ namespace endian # endif endian & operator=(value_type val) BOOST_NOEXCEPT { detail::big_reverse_copy(val, this->m_value); return *this; } + operator value_type() const BOOST_NOEXCEPT { return this->value(); } }; // unaligned float little endian specialization @@ -314,6 +317,7 @@ namespace endian # endif endian & operator=(value_type val) BOOST_NOEXCEPT { detail::little_reverse_copy(val, this->m_value); return *this; } + operator value_type() const BOOST_NOEXCEPT { return this->value(); } }; // unaligned double little endian specialization @@ -331,6 +335,7 @@ namespace endian # endif endian & operator=(value_type val) BOOST_NOEXCEPT { detail::little_reverse_copy(val, this->m_value); return *this; } + operator value_type() const BOOST_NOEXCEPT { return this->value(); } }; // unaligned little endian specialization @@ -355,6 +360,7 @@ namespace endian # endif endian & operator=(T val) BOOST_NOEXCEPT { detail::store_little_endian(this->m_value, val); return *this; } + operator value_type() const BOOST_NOEXCEPT { return this->value(); } }; // align::yes specializations; only n_bits == 16/32/64 supported @@ -386,6 +392,7 @@ namespace endian this->m_value = ::boost::endian::big_endian_value(val); return *this; } + operator value_type() const BOOST_NOEXCEPT { return this->value(); } }; // aligned little endian specialization @@ -414,6 +421,7 @@ namespace endian this->m_value = ::boost::endian::little_endian_value(val); return *this; } + operator value_type() const BOOST_NOEXCEPT { return this->value(); } }; } // namespace endian diff --git a/test/buffer_test.cpp b/test/buffer_test.cpp index 7411b4e..69846ab 100644 --- a/test/buffer_test.cpp +++ b/test/buffer_test.cpp @@ -35,7 +35,7 @@ int cpp_main(int, char *[]) x = 1234567890; cout << " operator==(buffer, built-in)" << endl; - bool b1(x == 1234567890); +// bool b1(x == 1234567890); // BOOST_TEST(x == 1234567890); cout << " done" << endl;