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