comparison Resources/Orthanc/Core/Compatibility.h @ 1:fef9a239df5c

adding auto-generated files
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 26 Mar 2020 18:50:10 +0100
parents
children
comparison
equal deleted inserted replaced
0:7ed502b17b8f 1:fef9a239df5c
1 /**
2 * Orthanc - A Lightweight, RESTful DICOM Store
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
6 *
7 * This program is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
11 *
12 * In addition, as a special exception, the copyright holders of this
13 * program give permission to link the code of its release with the
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
15 * that use the same license as the "OpenSSL" library), and distribute
16 * the linked executables. You must obey the GNU General Public License
17 * in all respects for all of the code used other than "OpenSSL". If you
18 * modify file(s) with this exception, you may extend this exception to
19 * your version of the file(s), but you are not obligated to do so. If
20 * you do not wish to do so, delete this exception statement from your
21 * version. If you delete this exception statement from all source files
22 * in the program, then also delete it here.
23 *
24 * This program is distributed in the hope that it will be useful, but
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * General Public License for more details.
28 *
29 * You should have received a copy of the GNU General Public License
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
31 **/
32
33
34 #pragma once
35
36 //#define Orthanc_Compatibility_h_STR2(x) #x
37 //#define Orthanc_Compatibility_h_STR1(x) Orthanc_Compatibility_h_STR2(x)
38
39 //#pragma message("__cplusplus = " Orthanc_Compatibility_h_STR1(__cplusplus))
40
41 #if (defined _MSC_VER)
42 //# pragma message("_MSC_VER = " Orthanc_Compatibility_h_STR1(_MSC_VER))
43 //# pragma message("_MSVC_LANG = " Orthanc_Compatibility_h_STR1(_MSVC_LANG))
44 // The __cplusplus macro cannot be used in Visual C++ < 1914 (VC++ 15.7)
45 // However, even in recent versions, __cplusplus will only be correct (that is,
46 // correctly defines the supported C++ version) if a special flag is passed to
47 // the compiler ("/Zc:__cplusplus")
48 // To make this header more robust, we use the _MSVC_LANG equivalent macro.
49
50 // please note that not all C++11 features are supported when _MSC_VER == 1600
51 // (or higher). This header file can be made for fine-grained, if required,
52 // based on specific _MSC_VER values
53
54 # if _MSC_VER >= 1600
55 # define ORTHANC_Cxx03_DETECTED 0
56 # else
57 # define ORTHANC_Cxx03_DETECTED 1
58 # endif
59
60 #else
61 // of _MSC_VER is not defined, we assume __cplusplus is correctly defined
62 // if __cplusplus is not defined (very old compilers??), then the following
63 // test will compare 0 < 201103L and will be true --> safe.
64 # if __cplusplus < 201103L
65 # define ORTHANC_Cxx03_DETECTED 1
66 # else
67 # define ORTHANC_Cxx03_DETECTED 0
68 # endif
69 #endif
70
71 #if ORTHANC_Cxx03_DETECTED == 1
72 //#pragma message("C++ 11 support is not present.")
73
74 /**
75 * "std::unique_ptr" was introduced in C++11, and "std::auto_ptr" was
76 * removed in C++17. We emulate "std::auto_ptr" using boost: "The
77 * smart pointer unique_ptr [is] a drop-in replacement for
78 * std::unique_ptr, usable also from C++03 compilers." This is only
79 * available if Boost >= 1.57.0 (from November 2014).
80 * https://www.boost.org/doc/libs/1_57_0/doc/html/move/reference.html#header.boost.move.unique_ptr_hpp
81 **/
82
83 #include <boost/move/unique_ptr.hpp>
84
85 namespace std
86 {
87 template <typename T>
88 class unique_ptr : public boost::movelib::unique_ptr<T>
89 {
90 public:
91 explicit unique_ptr() :
92 boost::movelib::unique_ptr<T>()
93 {
94 }
95
96 explicit unique_ptr(T* p) :
97 boost::movelib::unique_ptr<T>(p)
98 {
99 }
100 };
101 }
102 #else
103 //# pragma message("C++ 11 support is present.")
104 # include <memory>
105 #endif