Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.5 KiB

  1. //--------------------------------------------------------------------------------------------------
  2. /**
  3. @file qhArray.h
  4. @author Dirk Gregorius
  5. @version 0.1
  6. @date 03/12/2011
  7. Copyright(C) 2011 by D. Gregorius. All rights reserved.
  8. */
  9. //--------------------------------------------------------------------------------------------------
  10. #pragma once
  11. #include "qhTypes.h"
  12. #include "qhMemory.h"
  13. //--------------------------------------------------------------------------------------------------
  14. // qhArray
  15. //--------------------------------------------------------------------------------------------------
  16. template < typename T >
  17. class qhArray
  18. {
  19. public:
  20. qhArray( void );
  21. ~qhArray( void );
  22. int Capacity( void ) const;
  23. int Size( void ) const;
  24. bool Empty( void ) const;
  25. void Clear( void );
  26. void Reserve( int Count );
  27. void Resize( int Count );
  28. T& Expand( void );
  29. void PushBack( const T& Other );
  30. void PopBack( void );
  31. int IndexOf( const T& Element ) const;
  32. T& operator[]( int Offset );
  33. const T& operator[]( int Offset ) const;
  34. T& Front( void );
  35. const T& Front( void ) const;
  36. T& Back( void );
  37. const T& Back( void ) const;
  38. T* Begin( void );
  39. const T* Begin( void ) const;
  40. T* End( void );
  41. const T* End( void ) const;
  42. void Swap( qhArray< T >& Other );
  43. private:
  44. T* mBegin;
  45. T* mEnd;
  46. T* mCapacity;
  47. // Non-copyable
  48. qhArray( const qhArray& );
  49. qhArray& operator=( const qhArray& );
  50. };
  51. template < typename T >
  52. void qhSwap( qhArray< T >& Lhs, qhArray< T >& Rhs );
  53. #include "qhArray.inl"