static pair<PODType*, size_t> _Stl_expand_array(PODType* __array, size_t N, int index) { if ((int)N < index + 1) { size_t new_N = (max)(2 * N, size_t(index + 1)); PODType* new_array = __STATIC_CAST(PODType*,realloc(__array, new_N * sizeof(PODType))); if (new_array) { fill(new_array + N, new_array + new_N, PODType()); return pair<PODType*, size_t>(new_array, new_N); } else return pair<PODType*, size_t>(__STATIC_CAST(PODType*,0), 0); }
// ------------- Initialize the fixture and crash. ------------- int main(int argc, char** argv) { Fixture f; // Vector with objects f.objVector.push_back(PODType(1,1,1)); f.objVector.push_back(PODType(2, 2, 2)); f.objVector.push_back(PODType(3, 3, 3)); /// Vector with pointers f.ptrVector.push_back(new PODType(1, 1, 1)); f.ptrVector.push_back(new PODType(2, 2, 2)); f.ptrVector.push_back(new PODType(3, 3, 3)); // Map with primitives f.primitiveMap[1] = 2; f.primitiveMap[2] = 4; f.primitiveMap[3] = 6; f.primitiveMap[4] = 8; // Set with primitives f.primitiveSet.insert(1); f.primitiveSet.insert(3); f.primitiveSet.insert(2); // List with objects f.list.push_back(PODType(1, 2, 3)); f.list.push_back(PODType(4, 5, 6)); f.list.push_back(PODType(7, 8, 9)); char* str = "A new string is born, it may be long, it may be short, \r\nit may never stop. It has nothing to do with theory, everything is in the empirical truth."; wchar_t* strw = L"A longeru stringu.\r\nThis one is wide."; char super[80] = "This is also a\r\n super string"; wchar_t duper[80] = L"Super\r\nduper"; std::string strstr = "An std::string. This one is wide or not,\r\nit depends on the build?"; std::string shstr = "Yo\\\r\n"; // With an escaped backslash. std::wstring strwstr = L"Definitely long.\r\nstandard library too."; int* crash = nullptr; *crash = 42; }