Boost logo

Boost-Commit :

From: nielsdekker_at_[hidden]
Date: 2007-12-03 13:14:37


Author: niels_dekker
Date: 2007-12-03 13:14:37 EST (Mon, 03 Dec 2007)
New Revision: 41647
URL: http://svn.boost.org/trac/boost/changeset/41647

Log:
Added value_init test for C style array of bytes
Text files modified:
   trunk/libs/utility/value_init_test.cpp | 6 ++++++
   1 files changed, 6 insertions(+), 0 deletions(-)

Modified: trunk/libs/utility/value_init_test.cpp
==============================================================================
--- trunk/libs/utility/value_init_test.cpp (original)
+++ trunk/libs/utility/value_init_test.cpp 2007-12-03 13:14:37 EST (Mon, 03 Dec 2007)
@@ -152,6 +152,8 @@
 bool operator == ( AggregatePODStructWrapper const& lhs, AggregatePODStructWrapper const& rhs )
 { return lhs.dataMember == rhs.dataMember ; }
 
+typedef unsigned char ArrayOfBytes[256];
+
 //
 // This test function tests boost::value_initialized<T> for a specific type T.
 // The first argument (y) is assumed have the value of a value-initialized object.
@@ -232,6 +234,10 @@
   aggregatePODStructWrapper1.dataMember = nonZeroInitializedAggregatePODStruct;
   BOOST_CHECK ( test(aggregatePODStructWrapper0, aggregatePODStructWrapper1) );
 
+ ArrayOfBytes zeroInitializedArrayOfBytes = { 0 };
+ boost::value_initialized<ArrayOfBytes> valueInitializedArrayOfBytes;
+ BOOST_CHECK (std::memcmp(get(valueInitializedArrayOfBytes), zeroInitializedArrayOfBytes, sizeof(ArrayOfBytes)) == 0);
+
   return 0;
 }
 


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