Go to the documentation of this file.Go to the SVN repository for this file.
1 #ifndef CORELIB___NCBISTL__HPP
2 #define CORELIB___NCBISTL__HPP
40 #include <type_traits>
45 #if (_MSC_VER >= 1200)
47 # pragma warning(disable: 4786)
49 # pragma warning(disable: 4503)
51 # pragma warning(disable: 4511)
53 # pragma warning(disable: 4512)
55 # pragma warning(disable: 4097)
57 # pragma warning(disable: 4250)
59 # pragma warning(disable: 4355)
61 # pragma warning(disable: 4786)
72 #define BEGIN_SCOPE(ns) namespace ns {
75 #define END_SCOPE(ns) }
78 #define USING_SCOPE(ns) using namespace ns
83 #define NCBI_NS_STD std
86 #define NCBI_USING_NAMESPACE_STD using namespace NCBI_NS_STD
89 #define NCBI_NS_NCBI ncbi
92 #define BEGIN_STD_SCOPE BEGIN_SCOPE(NCBI_NS_STD)
95 #define END_STD_SCOPE END_SCOPE(NCBI_NS_STD)
100 #define BEGIN_NCBI_SCOPE BEGIN_SCOPE(NCBI_NS_NCBI)
103 #define END_NCBI_SCOPE END_SCOPE(NCBI_NS_NCBI)
106 #define USING_NCBI_SCOPE USING_SCOPE(NCBI_NS_NCBI)
119 #if !defined(NCBI_NAME2)
122 # define NCBI_NAME2(Name1, Name2) Name1##Name2
124 #if !defined(NCBI_NAME3)
127 # define NCBI_NAME3(Name1, Name2, Name3) Name1##Name2##Name3
130 #if !defined(NCBI_EAT_SEMICOLON)
131 namespace DummyNS {
class CDummyClassToEatSemicolon; }
132 # define NCBI_EAT_SEMICOLON(UniqueName) \
133 using ::DummyNS::CDummyClassToEatSemicolon
136 #define BEGIN_NAMESPACE(ns) namespace ns { NCBI_EAT_SEMICOLON(ns)
137 #define END_NAMESPACE(ns) } NCBI_EAT_SEMICOLON(ns)
138 #define BEGIN_NCBI_NAMESPACE BEGIN_NAMESPACE(NCBI_NS_NCBI)
139 #define END_NCBI_NAMESPACE END_NAMESPACE(NCBI_NS_NCBI)
140 #define BEGIN_STD_NAMESPACE BEGIN_NAMESPACE(NCBI_NS_STD)
141 #define END_STD_NAMESPACE END_NAMESPACE(NCBI_NS_STD)
142 #define BEGIN_LOCAL_NAMESPACE namespace { NCBI_EAT_SEMICOLON(ns)
143 #define END_LOCAL_NAMESPACE } NCBI_EAT_SEMICOLON(ns)
146 #define NCBI_AS_STRING(value) NCBI_AS_STRING2(value)
147 #define NCBI_AS_STRING2(value) #value
150 #if defined(NCBI_COMPILER_MSVC) && _MSC_VER < 1400 && !defined(for)
152 # define for if(0);else for
155 #if defined(NCBI_COMPILER_ICC) && NCBI_COMPILER_VERSION < 2000
157 #define EMPTY_TEMPLATE
159 #define EMPTY_TEMPLATE template<>
162 #ifdef NCBI_COMPILER_WORKSHOP
163 # if NCBI_COMPILER_VERSION < 530
170 # define BREAK(it) while (it) { ++(it); } break
172 # define BREAK(it) break
175 # define BREAK(it) break
178 #if defined(NCBI_COMPILER_GCC) || defined(NCBI_COMPILER_WORKSHOP)
179 # ifdef NCBI_COMPILER_GCC
180 # include <algorithm>
190 template<
typename Iter>
199 #if defined(_GLIBCXX_DEBUG)
201 # define NCBI_NON_POD_TYPE_STL_ITERATORS 1
206 #if defined(NCBI_HAVE_CXX11) && !defined(NCBI_TEST_CXX17)
208 # if defined(_GLIBCXX_DEPRECATED_ATTR)
210 # undef _GLIBCXX_DEPRECATED_ATTR
211 # define _GLIBCXX_DEPRECATED_ATTR
212 # include <backward/auto_ptr.h>
213 # undef _GLIBCXX_DEPRECATED_ATTR
214 # define _GLIBCXX_DEPRECATED_ATTR NCBI_DEPRECATED
215 # elif defined(_GLIBCXX_DEPRECATED)
217 # include <ext/concurrence.h>
218 # ifdef _GLIBCXX_THROW_OR_ABORT
220 # include <bits/alloc_traits.h>
221 # include <bits/unique_ptr.h>
222 # include <bits/shared_ptr.h>
224 # undef _GLIBCXX_DEPRECATED
225 # define _GLIBCXX_DEPRECATED
226 # include <backward/auto_ptr.h>
227 # undef _GLIBCXX_DEPRECATED
228 # define _GLIBCXX_DEPRECATED NCBI_DEPRECATED
229 # elif defined(_LIBCPP_DEPRECATED_IN_CXX11)
233 # include <stdexcept>
235 # undef _LIBCPP_DEPRECATED_IN_CXX11
236 # define _LIBCPP_DEPRECATED_IN_CXX11
238 # undef _LIBCPP_DEPRECATED_IN_CXX11
239 # define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED
243 #if defined(_LIBCPP_VERSION) && defined(__cpp_lib_hardware_interference_size)
244 # if _LIBCPP_VERSION < 12000
248 # undef __cpp_lib_hardware_interference_size
261 template <
template <
typename>
class TypeChecker,
typename Type>
271 template <
typename Type_>
276 template <
typename Type_>
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
#define NCBI_NS_NCBI
Define the name for the NCBI namespace.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_STD_SCOPE
Place it for adding new funtionality to STD scope.
#define NCBI_USING_NAMESPACE_STD
Use the std namespace.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static constexpr bool value
void iter_swap(Iter it1, Iter it2)
static not_supported chk(...)
#define END_STD_SCOPE
End previously defined STD scope.
static supported chk(typename std::decay< TypeChecker< Type_ >>::type *)
#define NCBI_NS_STD
Define the std namespace.
Defines to provide correct exporting from DLLs in some configurations.
Helper template to check that type Type have some method declared using TypeChecker<Type>.