forked from boostorg/endian
Revert to again supply the reverse_endianness_in_place template. This has the effect of providing a default reverse_endianness_in_place for user-defined types. Add error checking for UDT's to verify this works as desired. Provide a note in the conversion docs to that effect.
This commit is contained in:
1 parent
a0b5805b73
commit
55a65c3806
3 files changed
+106
-66
No files matched your search
@@ -39,7 +39,7 @@ namespace endian
|
||||
//--------------------------------------------------------------------------------------//
|
||||
// //
|
||||
// return-by-value interfaces //
|
||||
// return-by-value suggested by Phil Endecott //
|
||||
// suggested by Phil Endecott //
|
||||
// //
|
||||
// user-defined types (UDTs) //
|
||||
// //
|
||||
@@ -128,17 +128,10 @@ namespace endian
|
||||
// //
|
||||
//------------------------------------------------------------------------------------//
|
||||
|
||||
// customization for built-in arithmetic types
|
||||
inline void reverse_endianness_in_place(int8_t& x) BOOST_NOEXCEPT;
|
||||
inline void reverse_endianness_in_place(int16_t& x) BOOST_NOEXCEPT;
|
||||
inline void reverse_endianness_in_place(int32_t& x) BOOST_NOEXCEPT;
|
||||
inline void reverse_endianness_in_place(int64_t& x) BOOST_NOEXCEPT;
|
||||
inline void reverse_endianness_in_place(uint8_t& x) BOOST_NOEXCEPT;
|
||||
inline void reverse_endianness_in_place(uint16_t& x) BOOST_NOEXCEPT;
|
||||
inline void reverse_endianness_in_place(uint32_t& x) BOOST_NOEXCEPT;
|
||||
inline void reverse_endianness_in_place(uint64_t& x) BOOST_NOEXCEPT;
|
||||
inline void reverse_endianness_in_place(float& x) BOOST_NOEXCEPT;
|
||||
inline void reverse_endianness_in_place(double& x) BOOST_NOEXCEPT;
|
||||
// reverse in place
|
||||
template <class Value>
|
||||
inline void reverse_endianness_in_place(Value& x) BOOST_NOEXCEPT;
|
||||
// Effects: x = reverse_endianness(x)
|
||||
|
||||
// reverse in place unless native endianness is big
|
||||
template <class Reversible>
|
||||
@@ -413,27 +406,12 @@ namespace endian
|
||||
// reverse-in-place implementation //
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
// customization for built-in arithmetic types
|
||||
inline void reverse_endianness_in_place(int8_t& x) BOOST_NOEXCEPT
|
||||
{ x = reverse_endianness(x); }
|
||||
inline void reverse_endianness_in_place(int16_t& x) BOOST_NOEXCEPT
|
||||
{ x = reverse_endianness(x); }
|
||||
inline void reverse_endianness_in_place(int32_t& x) BOOST_NOEXCEPT
|
||||
{ x = reverse_endianness(x); }
|
||||
inline void reverse_endianness_in_place(int64_t& x) BOOST_NOEXCEPT
|
||||
{ x = reverse_endianness(x); }
|
||||
inline void reverse_endianness_in_place(uint8_t& x) BOOST_NOEXCEPT
|
||||
{ x = reverse_endianness(x); }
|
||||
inline void reverse_endianness_in_place(uint16_t& x) BOOST_NOEXCEPT
|
||||
{ x = reverse_endianness(x); }
|
||||
inline void reverse_endianness_in_place(uint32_t& x) BOOST_NOEXCEPT
|
||||
{ x = reverse_endianness(x); }
|
||||
inline void reverse_endianness_in_place(uint64_t& x) BOOST_NOEXCEPT
|
||||
{ x = reverse_endianness(x); }
|
||||
inline void reverse_endianness_in_place(float& x) BOOST_NOEXCEPT
|
||||
{ x = reverse_endianness(x); }
|
||||
inline void reverse_endianness_in_place(double& x) BOOST_NOEXCEPT
|
||||
{ x = reverse_endianness(x); }
|
||||
// reverse in place
|
||||
template <class Value>
|
||||
inline void reverse_endianness_in_place(Value& x) BOOST_NOEXCEPT
|
||||
{
|
||||
x = reverse_endianness(x);
|
||||
}
|
||||
|
||||
// reverse in place unless native endianness is big
|
||||
// Effects: none if native endian order is big,
|
||||
|
||||
Reference in new issue
Block a user