mirror of
https://github.com/boostorg/utility.git
synced 2025-05-11 13:24:02 +00:00
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]
[SVN r40089]
This commit is contained in:
parent
cd8f85afee
commit
42e0001370
@ -60,6 +60,20 @@ struct NonPOD : NonPODBase
|
|||||||
std::string id ;
|
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>
|
template<class T>
|
||||||
void test ( T const& y, T const& z )
|
void test ( T const& y, T const& z )
|
||||||
{
|
{
|
||||||
@ -98,6 +112,10 @@ int test_main(int, char **)
|
|||||||
NonPOD NonPOD_object( std::string("NonPOD_object") );
|
NonPOD NonPOD_object( std::string("NonPOD_object") );
|
||||||
test<NonPOD *>( 0, &NonPOD_object ) ;
|
test<NonPOD *>( 0, &NonPOD_object ) ;
|
||||||
|
|
||||||
|
AggregatePODStruct zeroInitializedAggregatePODStruct = { 0.0f, '\0', 0 };
|
||||||
|
AggregatePODStruct nonZeroInitializedAggregatePODStruct = { 1.25f, 'a', -1 };
|
||||||
|
test(zeroInitializedAggregatePODStruct, nonZeroInitializedAggregatePODStruct);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user