stdcpp.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. // stdcpp.h - originally written and placed in the public domain by Wei Dai
  2. /// \file stdcpp.h
  3. /// \brief Common C++ header files
  4. #ifndef CRYPTOPP_STDCPP_H
  5. #define CRYPTOPP_STDCPP_H
  6. #if _MSC_VER >= 1500
  7. #define _DO_NOT_DECLARE_INTERLOCKED_INTRINSICS_IN_MEMORY
  8. #include <intrin.h>
  9. #endif
  10. #include <string>
  11. #include <memory>
  12. #include <exception>
  13. #include <typeinfo>
  14. #include <algorithm>
  15. #include <functional>
  16. #include <utility>
  17. #include <vector>
  18. #include <limits>
  19. #include <deque>
  20. #include <list>
  21. #include <map>
  22. #include <new>
  23. // http://connect.microsoft.com/VisualStudio/feedback/details/1600701/type-info-does-not-compile-with-has-exceptions-0
  24. #if defined(_MSC_VER) && (_MSC_VER < 1900) && defined(_HAS_EXCEPTIONS) && (_HAS_EXCEPTIONS == 0)
  25. namespace std {
  26. using ::type_info;
  27. }
  28. #endif
  29. // workaround needed for IBM XLC and debug heaps on AIX
  30. #if defined(_AIX) && (defined(__xlc__) || defined(__xlC__) || defined(__ibmxl__))
  31. # if defined(__DEBUG_ALLOC__)
  32. namespace std {
  33. using ::_debug_memset;
  34. using ::_debug_memcpy;
  35. }
  36. # endif
  37. #endif
  38. // make_unchecked_array_iterator
  39. #if _MSC_VER >= 1600
  40. #include <iterator>
  41. #endif
  42. #if defined(CRYPTOPP_CXX11_ATOMIC)
  43. #include <atomic>
  44. #endif
  45. #if defined(CRYPTOPP_CXX11_SYNCHRONIZATION)
  46. #include <mutex>
  47. #endif
  48. #if defined(CRYPTOPP_CXX11_RVALUES)
  49. # include <utility>
  50. #endif
  51. #include <cstdlib>
  52. #include <cstring>
  53. #include <climits>
  54. #include <cmath>
  55. // It is 2019 and VS2017/Win10 still can't compile a
  56. // program that includes <cstddef> without making users
  57. // do something special. "Epic fail" comes to mind.
  58. // Also see https://github.com/weidai11/cryptopp/issues/781
  59. #ifndef _MSC_VER
  60. # include <cstddef>
  61. #endif
  62. // uintptr_t and ptrdiff_t
  63. #if defined(__SUNPRO_CC)
  64. # if (__SUNPRO_CC >= 0x5100)
  65. # include <stdint.h>
  66. # endif
  67. #elif defined(_MSC_VER)
  68. # if (_MSC_VER >= 1700)
  69. # include <stdint.h>
  70. # else
  71. # include <stddef.h>
  72. # endif
  73. #elif (__cplusplus < 201103L)
  74. # include <stdint.h>
  75. #endif
  76. // workaround needed on Sun Studio 12u1 Sun C++ 5.10 SunOS_i386 128229-02 2009/09/21
  77. #ifdef CRYPTOPP_INCLUDE_VECTOR_CC
  78. # include <vector.cc>
  79. #endif
  80. // C++Builder's standard library (Dinkumware) do not have C's global log() function
  81. // https://github.com/weidai11/cryptopp/issues/520
  82. #ifdef __BORLANDC__
  83. using std::log;
  84. #endif
  85. #endif // CRYPTOPP_STDCPP_H