Boost logo

Boost-Commit :

From: nielsdekker_at_[hidden]
Date: 2007-10-16 13:06:39


Author: niels_dekker
Date: 2007-10-16 13:06:39 EDT (Tue, 16 Oct 2007)
New Revision: 40089
URL: http://svn.boost.org/trac/boost/changeset/40089

Log:
Added value_initialized<T> test, having T as aggregate POD struct. In the past, this would have triggered MSVC warning C4345; this warning is now disabled within value_init.hpp, changeset [40088]
Text files modified:
   trunk/libs/utility/value_init_test.cpp | 18 ++++++++++++++++++
   1 files changed, 18 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-10-16 13:06:39 EDT (Tue, 16 Oct 2007)
@@ -60,6 +60,20 @@
   std::string id ;
 } ;
 
+//
+// Sample aggregate POD struct type
+//
+struct AggregatePODStruct
+{
+ float f;
+ char c;
+ int i;
+};
+
+bool operator == ( AggregatePODStruct const& lhs, AggregatePODStruct const& rhs )
+{ return lhs.f == rhs.f && lhs.c == rhs.c && lhs.i == rhs.i ; }
+
+
 template<class T>
 void test ( T const& y, T const& z )
 {
@@ -98,6 +112,10 @@
   NonPOD NonPOD_object( std::string("NonPOD_object") );
   test<NonPOD *>( 0, &NonPOD_object ) ;
 
+ AggregatePODStruct zeroInitializedAggregatePODStruct = { 0.0f, '\0', 0 };
+ AggregatePODStruct nonZeroInitializedAggregatePODStruct = { 1.25f, 'a', -1 };
+ test(zeroInitializedAggregatePODStruct, nonZeroInitializedAggregatePODStruct);
+
   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