Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74337 - sandbox/endian/boost/endian
From: bdawes_at_[hidden]
Date: 2011-09-10 15:56:10


Author: bemandawes
Date: 2011-09-10 15:56:10 EDT (Sat, 10 Sep 2011)
New Revision: 74337
URL: http://svn.boost.org/trac/boost/changeset/74337

Log:
Remove general reorder template. It doesn't work for classes with more than one member; each member must be reordered individually.
Text files modified:
   sandbox/endian/boost/endian/conversion2.hpp | 28 +++++-----------------------
   1 files changed, 5 insertions(+), 23 deletions(-)

Modified: sandbox/endian/boost/endian/conversion2.hpp
==============================================================================
--- sandbox/endian/boost/endian/conversion2.hpp (original)
+++ sandbox/endian/boost/endian/conversion2.hpp 2011-09-10 15:56:10 EDT (Sat, 10 Sep 2011)
@@ -21,10 +21,9 @@
 // -- reorder implementation approach suggested by tymofey, with avoidance of
 // undefined behavior as suggested by Giovanni Piero Deretta, and a further
 // refinement suggested by Pyry Jahkola.
-// -- general reorder function template to meet requests for UDT support by
-// Vicente Botet and others.
-// -- general reorder function template implementation approach using std::reverse
-// suggested by Mathias Gaunard
+//
+// Q: Why no general reorder template? A: It wouldn't work for classes with more than
+// one member; each member must be reordered individually.
 //
 //--------------------------------------------------------------------------------------//
 
@@ -45,16 +44,11 @@
 
   // TODO: Need implementation
   // TODO: Need to verify the return does not invoke undefined behavior (as might happen
- // if there are unutterable floating point values, such as happens with the unutterable
- // pointer values on some architectures
+ // if there are unutterable floating point values, similar to the unutterable pointer
+ // values on some architectures
   inline float reorder(float x);
   inline double reorder(double x);
 
- // TODO: Would pass by value be better for the following functions?
-
- template <class T>
- inline T reorder(const T& x);
-
   template <class T>
   inline T big(const T& x);
     // Return: x if native endianness is big, otherwise reorder(x);
@@ -115,18 +109,6 @@
            | (step16 & 0xFF00FF00FF00FF00) >> 8;
   }
 
-
- template <class T>
- inline T reorder(const T& x)
- {
- T tmp;
- std::reverse(
- reinterpret_cast<const char*>(&x),
- reinterpret_cast<const char*>(&x) + sizeof(T),
- reinterpret_cast<char*>(&tmp));
- return tmp;
- }
-
   template <class T>
   inline T big(const T& x)
   {


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk