$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r51785 - in sandbox/endian: boost/integer libs/integer/example
From: bdawes_at_[hidden]
Date: 2009-03-15 10:41:41
Author: bemandawes
Date: 2009-03-15 10:41:41 EDT (Sun, 15 Mar 2009)
New Revision: 51785
URL: http://svn.boost.org/trac/boost/changeset/51785
Log:
Endian: endian_hello_world tweaks
Text files modified: 
   sandbox/endian/boost/integer/cover_operators.hpp           |    10 +++++-----                              
   sandbox/endian/libs/integer/example/endian_hello_world.cpp |    13 +++++--------                           
   2 files changed, 10 insertions(+), 13 deletions(-)
Modified: sandbox/endian/boost/integer/cover_operators.hpp
==============================================================================
--- sandbox/endian/boost/integer/cover_operators.hpp	(original)
+++ sandbox/endian/boost/integer/cover_operators.hpp	2009-03-15 10:41:41 EDT (Sun, 15 Mar 2009)
@@ -65,16 +65,16 @@
       friend T& operator<<=(T& x, IntegerType y) { return x = +x << y; }
       friend T& operator>>=(T& x, IntegerType y) { return x = +x >> y; }
       
-      // A few binary arithmetic operations not covered by operators base class.
-      friend IntegerType operator<<(const T& x, IntegerType y) { return +x << y; }
-      friend IntegerType operator>>(const T& x, IntegerType y) { return +x >> y; }
-      
       // Auto-increment and auto-decrement can be defined in terms of the
       // arithmetic operations.
       friend T& operator++(T& x) { return x += 1; }
       friend T& operator--(T& x) { return x -= 1; }
 
-#   ifdef BOOST_MINIMAL_INTEGER_COVER_OPERATORS
+#   ifndef BOOST_MINIMAL_INTEGER_COVER_OPERATORS
+      // A few binary arithmetic operations not covered by operators base class.
+      friend IntegerType operator<<(const T& x, IntegerType y) { return +x << y; }
+      friend IntegerType operator>>(const T& x, IntegerType y) { return +x >> y; }
+      
       friend T operator++(T& x, int)
       { 
         T tmp(x);
Modified: sandbox/endian/libs/integer/example/endian_hello_world.cpp
==============================================================================
--- sandbox/endian/libs/integer/example/endian_hello_world.cpp	(original)
+++ sandbox/endian/libs/integer/example/endian_hello_world.cpp	2009-03-15 10:41:41 EDT (Sun, 15 Mar 2009)
@@ -9,6 +9,7 @@
 
 #include <boost/integer/endian.hpp>
 #include <boost/integer/endian_binary_stream.hpp>
+#include <boost/binary_stream.hpp>
 #include <iostream>
 
 using namespace boost;
@@ -16,14 +17,10 @@
 
 int main()
 {
-  int_least32_t value = 0x313233L;  // = 3224115 = ASCII { '1', '2', '3' }
-  big24_t       big( value );       
-  little24_t    little( value );
-
+  int_least32_t v = 0x31323334L;  // = ASCII { '1', '2', '3', '4' }
+                                  // value chosen to work on text stream
   std::cout << "Hello, endian world!\n";
-  std::cout << " cout << value--: " << value  << " sizeof(value): " << sizeof(value)
-          << "\n cout << big----: " << big    << " sizeof(big): " << sizeof(big)
-          << "\n cout << little-: " << little << " sizeof(little): " << sizeof(little)
-          << '\n';
+  std::cout << v << " " << big32_t(v) << " " << little32_t(v) << '\n';
+  std::cout <= v <= ' ' <= big32_t(v) <= ' ' <= little32_t(v) <= '\n';
 }