/************************************************************************ * * Licensed Materials - Property of IBM. * (C) Copyright IBM Corporation 2003, 2012. All Rights Reserved. * U.S. Government Users Restricted Rights: * Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. * ************************************************************************/ #ifndef __STLEXT_VECTOR_INCLUDE_____ #define __STLEXT_VECTOR_INCLUDE_____ #include #include "./mscext.hxx" #ifndef $D #define $D_IS_Locally_DEFINED #define $D ____noop #endif namespace stlext { template< typename T > struct vector { operator const T * () const{ return reinterpret_cast< const T * >( mpMemory ); } operator T * () { return reinterpret_cast< T * >( mpMemory ); } vector(): mpMemory( NULL ), mnSize( 0 ), mnCapacity( 0 ){} unsigned Count() const{ return mnSize; } T & back(){ return (*this)[mnSize-1]; } ~vector() { for( unsigned i=0; i=mnCapacity) throw "stlext::vector access out of memory!!!"; ); new (mpMemory[mnSize++]) T , ;} ) #undef __STLEXT_VECTOR_MAX_PARAMS private: typedef unsigned char BYTE; typedef BYTE element[sizeof(T)]; typedef int (&CheckSize)[ sizeof(element) == sizeof(T)]; element * mpMemory; unsigned mnSize; unsigned mnCapacity; }; } #ifdef $D_IS_Locally_DEFINED #undef $D_IS_Locally_DEFINED #undef $D #endif #endif