1e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#include <memory> 2e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#include <vector> 3e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#include <list> 4e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 5e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#include "cppunit/cppunit_proxy.h" 6e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 7e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) 8e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottusing namespace std; 9e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#endif 10e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 11e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott// 12e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott// TestCase class 13e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott// 14e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottclass UninitializedTest : public CPPUNIT_NS::TestCase 15e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott{ 16e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott CPPUNIT_TEST_SUITE(UninitializedTest); 17e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott CPPUNIT_TEST(copy_test); 18e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott //CPPUNIT_TEST(fill_test); 19e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott //CPPUNIT_TEST(fill_n_test); 20e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott CPPUNIT_TEST_SUITE_END(); 21e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 22e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottprotected: 23e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott void copy_test(); 24e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott void fill_test(); 25e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott void fill_n_test(); 26e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott}; 27e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 28e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick ScottCPPUNIT_TEST_SUITE_REGISTRATION(UninitializedTest); 29e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 30e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottstruct NotTrivialCopyStruct { 31e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott NotTrivialCopyStruct() : member(0) {} 32e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott NotTrivialCopyStruct(NotTrivialCopyStruct const&) : member(1) {} 33e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 34e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott int member; 35e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott}; 36e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 37e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottstruct TrivialCopyStruct { 38e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott TrivialCopyStruct() : member(0) {} 39e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott TrivialCopyStruct(TrivialCopyStruct const&) : member(1) {} 40e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 41e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott int member; 42e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott}; 43e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 44e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottstruct TrivialInitStruct { 45e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott TrivialInitStruct() 46e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott { ++nbConstructorCalls; } 47e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 48e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott static size_t nbConstructorCalls; 49e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott}; 50e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 51e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottsize_t TrivialInitStruct::nbConstructorCalls = 0; 52e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 53e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#if defined (STLPORT) 54e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott# if defined (_STLP_USE_NAMESPACES) 55e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottnamespace std { 56e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott# endif 57e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott _STLP_TEMPLATE_NULL 58e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott struct __type_traits<TrivialCopyStruct> { 59e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott typedef __false_type has_trivial_default_constructor; 60e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott //This is a wrong declaration just to check that internaly a simple memcpy is called: 61e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott typedef __true_type has_trivial_copy_constructor; 62e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott typedef __true_type has_trivial_assignment_operator; 63e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott typedef __true_type has_trivial_destructor; 64e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott typedef __false_type is_POD_type; 65e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott }; 66e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 67e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott _STLP_TEMPLATE_NULL 68e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott struct __type_traits<TrivialInitStruct> { 69e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott //This is a wrong declaration just to check that internaly no initialization is done: 70e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott typedef __true_type has_trivial_default_constructor; 71e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott typedef __true_type has_trivial_copy_constructor; 72e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott typedef __true_type has_trivial_assignment_operator; 73e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott typedef __true_type has_trivial_destructor; 74e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott typedef __false_type is_POD_type; 75e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott }; 76e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott# if defined (_STLP_USE_NAMESPACES) 77e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott} 78e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott# endif 79e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#endif 80e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 81e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottstruct base {}; 82e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottstruct derived : public base {}; 83e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 84e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott// 85e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott// tests implementation 86e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott// 87e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottvoid UninitializedTest::copy_test() 88e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott{ 89e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott { 90e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott //Random iterators 91e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott { 92e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott vector<NotTrivialCopyStruct> src(10); 93e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott vector<NotTrivialCopyStruct> dst(10); 94e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott uninitialized_copy(src.begin(), src.end(), dst.begin()); 95e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott vector<NotTrivialCopyStruct>::const_iterator it(dst.begin()), end(dst.end()); 96e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott for (; it != end; ++it) { 97e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott CPPUNIT_ASSERT( (*it).member == 1 ); 98e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 99e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 100e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott { 101e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott /** Note: we use static arrays here so the iterators are always 102e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott pointers, even in debug mode. */ 103e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott size_t const count = 10; 104e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott TrivialCopyStruct src[count]; 105e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott TrivialCopyStruct dst[count]; 106e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 107e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott TrivialCopyStruct* it = src + 0; 108e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott TrivialCopyStruct* end = src + count; 109e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott for (; it != end; ++it) { 110e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott (*it).member = 0; 111e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 112e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 113e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott uninitialized_copy(src+0, src+count, dst+0); 114e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott for (it = dst+0, end = dst+count; it != end; ++it) { 115e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#if defined (STLPORT) 116e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott /* If the member is 1, it means that library has not found any 117e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott optimization oportunity and called the regular copy-ctor instead. */ 118e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott CPPUNIT_ASSERT( (*it).member == 0 ); 119e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#else 120e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott CPPUNIT_ASSERT( (*it).member == 1 ); 121e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#endif 122e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 123e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 124e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 125e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 126e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott { 127e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott //Bidirectional iterator 128e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott { 129e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott vector<NotTrivialCopyStruct> src(10); 130e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott list<NotTrivialCopyStruct> dst(10); 131e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 132e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott list<NotTrivialCopyStruct>::iterator it(dst.begin()), end(dst.end()); 133e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott for (; it != end; ++it) { 134e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott (*it).member = -1; 135e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 136e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 137e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott uninitialized_copy(src.begin(), src.end(), dst.begin()); 138e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 139e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott for (it = dst.begin(); it != end; ++it) { 140e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott CPPUNIT_ASSERT( (*it).member == 1 ); 141e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 142e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 143e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 144e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott { 145e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott list<NotTrivialCopyStruct> src(10); 146e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott vector<NotTrivialCopyStruct> dst(10); 147e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 148e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott vector<NotTrivialCopyStruct>::iterator it(dst.begin()), end(dst.end()); 149e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott for (; it != end; ++it) { 150e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott (*it).member = -1; 151e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 152e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 153e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott uninitialized_copy(src.begin(), src.end(), dst.begin()); 154e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 155e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott for (it = dst.begin(); it != end; ++it) { 156e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott CPPUNIT_ASSERT( (*it).member == 1 ); 157e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 158e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 159e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 160e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 161e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott { 162e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott //Using containers of native types: 163e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#if !defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES) 164e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott { 165e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott vector<int> src; 166e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott int i; 167e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott for (i = -5; i < 6; ++i) { 168e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott src.push_back(i); 169e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 170e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 171e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott //Building a vector result in a uninitialized_copy call internally 172e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott vector<unsigned int> dst(src.begin(), src.end()); 173e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott vector<unsigned int>::const_iterator it(dst.begin()); 174e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott for (i = -5; i < 6; ++i, ++it) { 175e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott CPPUNIT_ASSERT( *it == (unsigned int)i ); 176e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 177e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 178e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 179e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott { 180e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott vector<char> src; 181e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott char i; 182e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott for (i = -5; i < 6; ++i) { 183e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott src.push_back(i); 184e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 185e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 186e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott //Building a vector result in a uninitialized_copy call internally 187e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott vector<unsigned int> dst(src.begin(), src.end()); 188e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott vector<unsigned int>::const_iterator it(dst.begin()); 189e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott for (i = -5; i < 6; ++i, ++it) { 190e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott CPPUNIT_ASSERT( *it == (unsigned int)i ); 191e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 192e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 193e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 194e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott { 195e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott vector<int> src; 196e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott int i; 197e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott for (i = -5; i < 6; ++i) { 198e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott src.push_back(i); 199e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 200e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 201e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott //Building a vector result in a uninitialized_copy call internally 202e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott vector<float> dst(src.begin(), src.end()); 203e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott vector<float>::const_iterator it(dst.begin()); 204e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott for (i = -5; i < 6; ++i, ++it) { 205e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott CPPUNIT_ASSERT( *it == (float)i ); 206e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 207e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 208e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 209e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott { 210e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott vector<vector<float>*> src(10); 211e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott vector<vector<float>*> dst(src.begin(), src.end()); 212e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 213e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 214e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott { 215e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott derived d; 216e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott //base *pb = &d; 217e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott derived *pd = &d; 218e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott //base **ppb = &pd; 219e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott vector<derived*> src(10, pd); 220e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott vector<base*> dst(src.begin(), src.end()); 221e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott vector<base*>::iterator it(dst.begin()), end(dst.end()); 222e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott for (; it != end; ++it) { 223e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott CPPUNIT_ASSERT( (*it) == pd ); 224e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 225e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 226e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott#endif 227e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 228e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 229e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott { 230e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott //Vector initialization: 231e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott vector<TrivialInitStruct> vect(10); 232e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott //Just 1 constructor call for the default value: 233e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott CPPUNIT_ASSERT( TrivialInitStruct::nbConstructorCalls == 1 ); 234e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott } 235e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott} 236e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 237e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott/* 238e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottvoid UninitializedTest::fill_test() 239e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott{ 240e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott} 241e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott 242e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scottvoid UninitializedTest::fill_n_test() 243e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott{ 244e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott} 245e46c9386c4f79aa40185f79a19fc5b2a7ef528b3Patrick Scott*/ 246