Source code of Windows XP (NT5)
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.

80 lines
1.4 KiB

  1. #pragma once
  2. #ifndef _STLNEW_H_
  3. #define _STLNEW_H_
  4. //#include <exception>
  5. #include <stlexcep.h>
  6. #include "ncmem.h"
  7. #ifdef _MSC_VER
  8. #pragma pack(push,8)
  9. #endif /* _MSC_VER */
  10. _STD_BEGIN
  11. // CLASS bad_alloc
  12. class /*_CRTIMP*/ bad_alloc : public exception
  13. {
  14. public:
  15. bad_alloc(const char *_S = "bad allocation") _THROW0() : exception(_S)
  16. {
  17. }
  18. virtual ~bad_alloc() _THROW0()
  19. {
  20. }
  21. protected:
  22. virtual void _Doraise() const
  23. {
  24. _RAISE(*this);
  25. }
  26. };
  27. // SUPPORT TYPES
  28. struct nothrow_t
  29. {
  30. };
  31. extern /*_CRTIMP*/ const nothrow_t nothrow;
  32. _STD_END
  33. /*
  34. typedef void (__cdecl *new_handler)();
  35. extern new_handler _New_hand;
  36. // new AND delete DECLARATIONS
  37. void __cdecl operator delete(void *) _THROW0();
  38. void* __cdecl operator new(size_t) _THROW1(std::bad_alloc);
  39. void* __cdecl operator new(size_t, const std::nothrow_t&) _THROW0();
  40. */
  41. #ifndef __PLACEMENT_NEW_INLINE
  42. #define __PLACEMENT_NEW_INLINE
  43. inline void *__cdecl operator new(size_t, void *_P)
  44. {
  45. return (_P);
  46. }
  47. #if _MSC_VER >= 1200
  48. inline void __cdecl operator delete(void *, void*)
  49. {
  50. return;
  51. }
  52. #endif
  53. #endif
  54. /*
  55. #ifdef _CRTIMP
  56. _CRTIMP
  57. #endif
  58. new_handler __cdecl set_new_handler(new_handler) _THROW0();
  59. */
  60. #ifdef _MSC_VER
  61. #pragma pack(pop)
  62. #endif /* _MSC_VER */
  63. #endif /* _STLNEW_H_ */
  64. /*
  65. * Copyright (c) 1994 by P.J. Plauger. ALL RIGHTS RESERVED.
  66. * Consult your license regarding permissions and restrictions.
  67. */