sparsam 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,781 @@
1
+ #if !defined(spp_config_h_guard)
2
+ #define spp_config_h_guard
3
+
4
+ // --------------------------------------------------
5
+ // Sparsepp config macros
6
+ // some can be overriden on the command line
7
+ // --------------------------------------------------
8
+ #ifndef SPP_NAMESPACE
9
+ #define SPP_NAMESPACE spp
10
+ #endif
11
+
12
+ #ifndef spp_
13
+ #define spp_ SPP_NAMESPACE
14
+ #endif
15
+
16
+ #ifndef SPP_DEFAULT_ALLOCATOR
17
+ #if (defined(SPP_USE_SPP_ALLOC) && SPP_USE_SPP_ALLOC) && defined(_MSC_VER)
18
+ // -----------------------------------------------------------------------------
19
+ // When building with the Microsoft compiler, we use a custom allocator because
20
+ // the default one fragments memory when reallocating. This is desirable only
21
+ // when creating large sparsepp hash maps. If you create lots of small hash_maps,
22
+ // define the following before including spp.h:
23
+ // #define SPP_DEFAULT_ALLOCATOR spp::libc_allocator
24
+ // -----------------------------------------------------------------------------
25
+ #define SPP_DEFAULT_ALLOCATOR spp_::spp_allocator
26
+ #define SPP_INCLUDE_SPP_ALLOC
27
+ #else
28
+ #define SPP_DEFAULT_ALLOCATOR spp_::libc_allocator
29
+ #endif
30
+ #endif
31
+
32
+ #ifndef SPP_GROUP_SIZE
33
+ // must be 32 or 64
34
+ #define SPP_GROUP_SIZE 32
35
+ #endif
36
+
37
+ #ifndef SPP_ALLOC_SZ
38
+ // must be power of 2 (0 = agressive alloc, 1 = smallest memory usage, 2 = good compromise)
39
+ #define SPP_ALLOC_SZ 0
40
+ #endif
41
+
42
+ #ifndef SPP_STORE_NUM_ITEMS
43
+ // 1 uses a little bit more memory, but faster!!
44
+ #define SPP_STORE_NUM_ITEMS 1
45
+ #endif
46
+
47
+
48
+ // ---------------------------------------------------------------------------
49
+ // Compiler detection code (SPP_ proprocessor macros) derived from Boost
50
+ // libraries. Therefore Boost software licence reproduced below.
51
+ // ---------------------------------------------------------------------------
52
+ // Boost Software License - Version 1.0 - August 17th, 2003
53
+ //
54
+ // Permission is hereby granted, free of charge, to any person or organization
55
+ // obtaining a copy of the software and accompanying documentation covered by
56
+ // this license (the "Software") to use, reproduce, display, distribute,
57
+ // execute, and transmit the Software, and to prepare derivative works of the
58
+ // Software, and to permit third-parties to whom the Software is furnished to
59
+ // do so, all subject to the following:
60
+ //
61
+ // The copyright notices in the Software and this entire statement, including
62
+ // the above license grant, this restriction and the following disclaimer,
63
+ // must be included in all copies of the Software, in whole or in part, and
64
+ // all derivative works of the Software, unless such copies or derivative
65
+ // works are solely in the form of machine-executable object code generated by
66
+ // a source language processor.
67
+ //
68
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
69
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
70
+ // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
71
+ // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
72
+ // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
73
+ // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
74
+ // DEALINGS IN THE SOFTWARE.
75
+ // ---------------------------------------------------------------------------
76
+
77
+ // Boost like configuration
78
+ // ------------------------
79
+ #if defined __clang__
80
+
81
+ #if defined(i386)
82
+ #include <cpuid.h>
83
+ inline void spp_cpuid(int info[4], int InfoType) {
84
+ __cpuid_count(InfoType, 0, info[0], info[1], info[2], info[3]);
85
+ }
86
+ #endif
87
+
88
+ #define SPP_POPCNT __builtin_popcount
89
+ #define SPP_POPCNT64 __builtin_popcountll
90
+
91
+ #define SPP_HAS_CSTDINT
92
+
93
+ #ifndef __has_extension
94
+ #define __has_extension __has_feature
95
+ #endif
96
+
97
+ #if !__has_feature(cxx_exceptions) && !defined(SPP_NO_EXCEPTIONS)
98
+ #define SPP_NO_EXCEPTIONS
99
+ #endif
100
+
101
+ #if !__has_feature(cxx_rtti) && !defined(SPP_NO_RTTI)
102
+ #define SPP_NO_RTTI
103
+ #endif
104
+
105
+ #if !__has_feature(cxx_rtti) && !defined(SPP_NO_TYPEID)
106
+ #define SPP_NO_TYPEID
107
+ #endif
108
+
109
+ #if defined(__int64) && !defined(__GNUC__)
110
+ #define SPP_HAS_MS_INT64
111
+ #endif
112
+
113
+ #define SPP_HAS_NRVO
114
+
115
+ // Branch prediction hints
116
+ #if defined(__has_builtin)
117
+ #if __has_builtin(__builtin_expect)
118
+ #define SPP_LIKELY(x) __builtin_expect(x, 1)
119
+ #define SPP_UNLIKELY(x) __builtin_expect(x, 0)
120
+ #endif
121
+ #endif
122
+
123
+ // Clang supports "long long" in all compilation modes.
124
+ #define SPP_HAS_LONG_LONG
125
+
126
+ #if !__has_feature(cxx_constexpr)
127
+ #define SPP_NO_CXX11_CONSTEXPR
128
+ #endif
129
+
130
+ #if !__has_feature(cxx_decltype)
131
+ #define SPP_NO_CXX11_DECLTYPE
132
+ #endif
133
+
134
+ #if !__has_feature(cxx_decltype_incomplete_return_types)
135
+ #define SPP_NO_CXX11_DECLTYPE_N3276
136
+ #endif
137
+
138
+ #if !__has_feature(cxx_defaulted_functions)
139
+ #define SPP_NO_CXX11_DEFAULTED_FUNCTIONS
140
+ #endif
141
+
142
+ #if !__has_feature(cxx_deleted_functions)
143
+ #define SPP_NO_CXX11_DELETED_FUNCTIONS
144
+ #endif
145
+
146
+ #if !__has_feature(cxx_explicit_conversions)
147
+ #define SPP_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
148
+ #endif
149
+
150
+ #if !__has_feature(cxx_default_function_template_args)
151
+ #define SPP_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
152
+ #endif
153
+
154
+ #if !__has_feature(cxx_generalized_initializers)
155
+ #define SPP_NO_CXX11_HDR_INITIALIZER_LIST
156
+ #endif
157
+
158
+ #if !__has_feature(cxx_lambdas)
159
+ #define SPP_NO_CXX11_LAMBDAS
160
+ #endif
161
+
162
+ #if !__has_feature(cxx_local_type_template_args)
163
+ #define SPP_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
164
+ #endif
165
+
166
+ #if !__has_feature(cxx_raw_string_literals)
167
+ #define SPP_NO_CXX11_RAW_LITERALS
168
+ #endif
169
+
170
+ #if !__has_feature(cxx_reference_qualified_functions)
171
+ #define SPP_NO_CXX11_REF_QUALIFIERS
172
+ #endif
173
+
174
+ #if !__has_feature(cxx_generalized_initializers)
175
+ #define SPP_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
176
+ #endif
177
+
178
+ #if !__has_feature(cxx_rvalue_references)
179
+ #define SPP_NO_CXX11_RVALUE_REFERENCES
180
+ #endif
181
+
182
+ #if !__has_feature(cxx_static_assert)
183
+ #define SPP_NO_CXX11_STATIC_ASSERT
184
+ #endif
185
+
186
+ #if !__has_feature(cxx_alias_templates)
187
+ #define SPP_NO_CXX11_TEMPLATE_ALIASES
188
+ #endif
189
+
190
+ #if !__has_feature(cxx_variadic_templates)
191
+ #define SPP_NO_CXX11_VARIADIC_TEMPLATES
192
+ #endif
193
+
194
+ #if !__has_feature(cxx_user_literals)
195
+ #define SPP_NO_CXX11_USER_DEFINED_LITERALS
196
+ #endif
197
+
198
+ #if !__has_feature(cxx_alignas)
199
+ #define SPP_NO_CXX11_ALIGNAS
200
+ #endif
201
+
202
+ #if !__has_feature(cxx_trailing_return)
203
+ #define SPP_NO_CXX11_TRAILING_RESULT_TYPES
204
+ #endif
205
+
206
+ #if !__has_feature(cxx_inline_namespaces)
207
+ #define SPP_NO_CXX11_INLINE_NAMESPACES
208
+ #endif
209
+
210
+ #if !__has_feature(cxx_override_control)
211
+ #define SPP_NO_CXX11_FINAL
212
+ #endif
213
+
214
+ #if !(__has_feature(__cxx_binary_literals__) || __has_extension(__cxx_binary_literals__))
215
+ #define SPP_NO_CXX14_BINARY_LITERALS
216
+ #endif
217
+
218
+ #if !__has_feature(__cxx_decltype_auto__)
219
+ #define SPP_NO_CXX14_DECLTYPE_AUTO
220
+ #endif
221
+
222
+ #if !__has_feature(__cxx_init_captures__)
223
+ #define SPP_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
224
+ #endif
225
+
226
+ #if !__has_feature(__cxx_generic_lambdas__)
227
+ #define SPP_NO_CXX14_GENERIC_LAMBDAS
228
+ #endif
229
+
230
+
231
+ #if !__has_feature(__cxx_generic_lambdas__) || !__has_feature(__cxx_relaxed_constexpr__)
232
+ #define SPP_NO_CXX14_CONSTEXPR
233
+ #endif
234
+
235
+ #if !__has_feature(__cxx_return_type_deduction__)
236
+ #define SPP_NO_CXX14_RETURN_TYPE_DEDUCTION
237
+ #endif
238
+
239
+ #if !__has_feature(__cxx_variable_templates__)
240
+ #define SPP_NO_CXX14_VARIABLE_TEMPLATES
241
+ #endif
242
+
243
+ #if __cplusplus < 201400
244
+ #define SPP_NO_CXX14_DIGIT_SEPARATORS
245
+ #endif
246
+
247
+ #if defined(__has_builtin) && __has_builtin(__builtin_unreachable)
248
+ #define SPP_UNREACHABLE_RETURN(x) __builtin_unreachable();
249
+ #endif
250
+
251
+ #define SPP_ATTRIBUTE_UNUSED __attribute__((__unused__))
252
+
253
+ #ifndef SPP_COMPILER
254
+ #define SPP_COMPILER "Clang version " __clang_version__
255
+ #endif
256
+
257
+ #define SPP_CLANG 1
258
+
259
+
260
+ #elif defined __GNUC__
261
+
262
+ #define SPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
263
+
264
+ // definition to expand macro then apply to pragma message
265
+ // #define VALUE_TO_STRING(x) #x
266
+ // #define VALUE(x) VALUE_TO_STRING(x)
267
+ // #define VAR_NAME_VALUE(var) #var "=" VALUE(var)
268
+ // #pragma message(VAR_NAME_VALUE(SPP_GCC_VERSION))
269
+
270
+ #if defined(i386)
271
+ #include <cpuid.h>
272
+ inline void spp_cpuid(int info[4], int InfoType) {
273
+ __cpuid_count(InfoType, 0, info[0], info[1], info[2], info[3]);
274
+ }
275
+ #endif
276
+
277
+ // __POPCNT__ defined when the compiled with popcount support
278
+ // (-mpopcnt compiler option is given for example)
279
+ #ifdef __POPCNT__
280
+ // slower unless compiled iwith -mpopcnt
281
+ #define SPP_POPCNT __builtin_popcount
282
+ #define SPP_POPCNT64 __builtin_popcountll
283
+ #endif
284
+
285
+ #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
286
+ #define SPP_GCC_CXX11
287
+ #endif
288
+
289
+ #if __GNUC__ == 3
290
+ #if defined (__PATHSCALE__)
291
+ #define SPP_NO_TWO_PHASE_NAME_LOOKUP
292
+ #define SPP_NO_IS_ABSTRACT
293
+ #endif
294
+
295
+ #if __GNUC_MINOR__ < 4
296
+ #define SPP_NO_IS_ABSTRACT
297
+ #endif
298
+
299
+ #define SPP_NO_CXX11_EXTERN_TEMPLATE
300
+ #endif
301
+
302
+ #if __GNUC__ < 4
303
+ //
304
+ // All problems to gcc-3.x and earlier here:
305
+ //
306
+ #define SPP_NO_TWO_PHASE_NAME_LOOKUP
307
+ #ifdef __OPEN64__
308
+ #define SPP_NO_IS_ABSTRACT
309
+ #endif
310
+ #endif
311
+
312
+ // GCC prior to 3.4 had #pragma once too but it didn't work well with filesystem links
313
+ #if SPP_GCC_VERSION >= 30400
314
+ #define SPP_HAS_PRAGMA_ONCE
315
+ #endif
316
+
317
+ #if SPP_GCC_VERSION < 40400
318
+ // Previous versions of GCC did not completely implement value-initialization:
319
+ // GCC Bug 30111, "Value-initialization of POD base class doesn't initialize
320
+ // members", reported by Jonathan Wakely in 2006,
321
+ // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30111 (fixed for GCC 4.4)
322
+ // GCC Bug 33916, "Default constructor fails to initialize array members",
323
+ // reported by Michael Elizabeth Chastain in 2007,
324
+ // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33916 (fixed for GCC 4.2.4)
325
+ // See also: http://www.boost.org/libs/utility/value_init.htm #compiler_issues
326
+ #define SPP_NO_COMPLETE_VALUE_INITIALIZATION
327
+ #endif
328
+
329
+ #if !defined(__EXCEPTIONS) && !defined(SPP_NO_EXCEPTIONS)
330
+ #define SPP_NO_EXCEPTIONS
331
+ #endif
332
+
333
+ //
334
+ // Threading support: Turn this on unconditionally here (except for
335
+ // those platforms where we can know for sure). It will get turned off again
336
+ // later if no threading API is detected.
337
+ //
338
+ #if !defined(__MINGW32__) && !defined(linux) && !defined(__linux) && !defined(__linux__)
339
+ #define SPP_HAS_THREADS
340
+ #endif
341
+
342
+ //
343
+ // gcc has "long long"
344
+ // Except on Darwin with standard compliance enabled (-pedantic)
345
+ // Apple gcc helpfully defines this macro we can query
346
+ //
347
+ #if !defined(__DARWIN_NO_LONG_LONG)
348
+ #define SPP_HAS_LONG_LONG
349
+ #endif
350
+
351
+ //
352
+ // gcc implements the named return value optimization since version 3.1
353
+ //
354
+ #define SPP_HAS_NRVO
355
+
356
+ // Branch prediction hints
357
+ #define SPP_LIKELY(x) __builtin_expect(x, 1)
358
+ #define SPP_UNLIKELY(x) __builtin_expect(x, 0)
359
+
360
+ //
361
+ // Dynamic shared object (DSO) and dynamic-link library (DLL) support
362
+ //
363
+ #if __GNUC__ >= 4
364
+ #if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && !defined(__CYGWIN__)
365
+ // All Win32 development environments, including 64-bit Windows and MinGW, define
366
+ // _WIN32 or one of its variant spellings. Note that Cygwin is a POSIX environment,
367
+ // so does not define _WIN32 or its variants.
368
+ #define SPP_HAS_DECLSPEC
369
+ #define SPP_SYMBOL_EXPORT __attribute__((__dllexport__))
370
+ #define SPP_SYMBOL_IMPORT __attribute__((__dllimport__))
371
+ #else
372
+ #define SPP_SYMBOL_EXPORT __attribute__((__visibility__("default")))
373
+ #define SPP_SYMBOL_IMPORT
374
+ #endif
375
+
376
+ #define SPP_SYMBOL_VISIBLE __attribute__((__visibility__("default")))
377
+ #else
378
+ // config/platform/win32.hpp will define SPP_SYMBOL_EXPORT, etc., unless already defined
379
+ #define SPP_SYMBOL_EXPORT
380
+ #endif
381
+
382
+ //
383
+ // RTTI and typeinfo detection is possible post gcc-4.3:
384
+ //
385
+ #if SPP_GCC_VERSION > 40300
386
+ #ifndef __GXX_RTTI
387
+ #ifndef SPP_NO_TYPEID
388
+ #define SPP_NO_TYPEID
389
+ #endif
390
+ #ifndef SPP_NO_RTTI
391
+ #define SPP_NO_RTTI
392
+ #endif
393
+ #endif
394
+ #endif
395
+
396
+ //
397
+ // Recent GCC versions have __int128 when in 64-bit mode.
398
+ //
399
+ // We disable this if the compiler is really nvcc with C++03 as it
400
+ // doesn't actually support __int128 as of CUDA_VERSION=7500
401
+ // even though it defines __SIZEOF_INT128__.
402
+ // See https://svn.boost.org/trac/boost/ticket/8048
403
+ // https://svn.boost.org/trac/boost/ticket/11852
404
+ // Only re-enable this for nvcc if you're absolutely sure
405
+ // of the circumstances under which it's supported:
406
+ //
407
+ #if defined(__CUDACC__)
408
+ #if defined(SPP_GCC_CXX11)
409
+ #define SPP_NVCC_CXX11
410
+ #else
411
+ #define SPP_NVCC_CXX03
412
+ #endif
413
+ #endif
414
+
415
+ #if defined(__SIZEOF_INT128__) && !defined(SPP_NVCC_CXX03)
416
+ #define SPP_HAS_INT128
417
+ #endif
418
+ //
419
+ // Recent GCC versions have a __float128 native type, we need to
420
+ // include a std lib header to detect this - not ideal, but we'll
421
+ // be including <cstddef> later anyway when we select the std lib.
422
+ //
423
+ // Nevertheless, as of CUDA 7.5, using __float128 with the host
424
+ // compiler in pre-C++11 mode is still not supported.
425
+ // See https://svn.boost.org/trac/boost/ticket/11852
426
+ //
427
+ #ifdef __cplusplus
428
+ #include <cstddef>
429
+ #else
430
+ #include <stddef.h>
431
+ #endif
432
+
433
+ #if defined(_GLIBCXX_USE_FLOAT128) && !defined(__STRICT_ANSI__) && !defined(SPP_NVCC_CXX03)
434
+ #define SPP_HAS_FLOAT128
435
+ #endif
436
+
437
+ // C++0x features in 4.3.n and later
438
+ //
439
+ #if (SPP_GCC_VERSION >= 40300) && defined(SPP_GCC_CXX11)
440
+ // C++0x features are only enabled when -std=c++0x or -std=gnu++0x are
441
+ // passed on the command line, which in turn defines
442
+ // __GXX_EXPERIMENTAL_CXX0X__.
443
+ #define SPP_HAS_DECLTYPE
444
+ #define SPP_HAS_RVALUE_REFS
445
+ #define SPP_HAS_STATIC_ASSERT
446
+ #define SPP_HAS_VARIADIC_TMPL
447
+ #define SPP_HAS_CSTDINT
448
+ #else
449
+ #define SPP_NO_CXX11_DECLTYPE
450
+ #define SPP_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
451
+ #define SPP_NO_CXX11_RVALUE_REFERENCES
452
+ #define SPP_NO_CXX11_STATIC_ASSERT
453
+ #endif
454
+
455
+ // C++0x features in 4.4.n and later
456
+ //
457
+ #if (SPP_GCC_VERSION < 40400) || !defined(SPP_GCC_CXX11)
458
+ #define SPP_NO_CXX11_AUTO_DECLARATIONS
459
+ #define SPP_NO_CXX11_AUTO_MULTIDECLARATIONS
460
+ #define SPP_NO_CXX11_CHAR16_T
461
+ #define SPP_NO_CXX11_CHAR32_T
462
+ #define SPP_NO_CXX11_HDR_INITIALIZER_LIST
463
+ #define SPP_NO_CXX11_DEFAULTED_FUNCTIONS
464
+ #define SPP_NO_CXX11_DELETED_FUNCTIONS
465
+ #define SPP_NO_CXX11_TRAILING_RESULT_TYPES
466
+ #define SPP_NO_CXX11_INLINE_NAMESPACES
467
+ #define SPP_NO_CXX11_VARIADIC_TEMPLATES
468
+ #endif
469
+
470
+ #if SPP_GCC_VERSION < 40500
471
+ #define SPP_NO_SFINAE_EXPR
472
+ #endif
473
+
474
+ // GCC 4.5 forbids declaration of defaulted functions in private or protected sections
475
+ #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ == 5) || !defined(SPP_GCC_CXX11)
476
+ #define SPP_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS
477
+ #endif
478
+
479
+ // C++0x features in 4.5.0 and later
480
+ //
481
+ #if (SPP_GCC_VERSION < 40500) || !defined(SPP_GCC_CXX11)
482
+ #define SPP_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
483
+ #define SPP_NO_CXX11_LAMBDAS
484
+ #define SPP_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
485
+ #define SPP_NO_CXX11_RAW_LITERALS
486
+ #endif
487
+
488
+ // C++0x features in 4.6.n and later
489
+ //
490
+ #if (SPP_GCC_VERSION < 40600) || !defined(SPP_GCC_CXX11)
491
+ #define SPP_NO_CXX11_CONSTEXPR
492
+ #define SPP_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
493
+ #endif
494
+
495
+ // C++0x features in 4.7.n and later
496
+ //
497
+ #if (SPP_GCC_VERSION < 40700) || !defined(SPP_GCC_CXX11)
498
+ #define SPP_NO_CXX11_FINAL
499
+ #define SPP_NO_CXX11_TEMPLATE_ALIASES
500
+ #define SPP_NO_CXX11_USER_DEFINED_LITERALS
501
+ #define SPP_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS
502
+ #endif
503
+
504
+ // C++0x features in 4.8.n and later
505
+ //
506
+ #if (SPP_GCC_VERSION < 40800) || !defined(SPP_GCC_CXX11)
507
+ #define SPP_NO_CXX11_ALIGNAS
508
+ #endif
509
+
510
+ // C++0x features in 4.8.1 and later
511
+ //
512
+ #if (SPP_GCC_VERSION < 40801) || !defined(SPP_GCC_CXX11)
513
+ #define SPP_NO_CXX11_DECLTYPE_N3276
514
+ #define SPP_NO_CXX11_REF_QUALIFIERS
515
+ #define SPP_NO_CXX14_BINARY_LITERALS
516
+ #endif
517
+
518
+ // C++14 features in 4.9.0 and later
519
+ //
520
+ #if (SPP_GCC_VERSION < 40900) || (__cplusplus < 201300)
521
+ #define SPP_NO_CXX14_RETURN_TYPE_DEDUCTION
522
+ #define SPP_NO_CXX14_GENERIC_LAMBDAS
523
+ #define SPP_NO_CXX14_DIGIT_SEPARATORS
524
+ #define SPP_NO_CXX14_DECLTYPE_AUTO
525
+ #if !((SPP_GCC_VERSION >= 40801) && (SPP_GCC_VERSION < 40900) && defined(SPP_GCC_CXX11))
526
+ #define SPP_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
527
+ #endif
528
+ #endif
529
+
530
+
531
+ // C++ 14:
532
+ #if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
533
+ #define SPP_NO_CXX14_CONSTEXPR
534
+ #endif
535
+ #if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
536
+ #define SPP_NO_CXX14_VARIABLE_TEMPLATES
537
+ #endif
538
+
539
+ //
540
+ // Unused attribute:
541
+ #if __GNUC__ >= 4
542
+ #define SPP_ATTRIBUTE_UNUSED __attribute__((__unused__))
543
+ #endif
544
+ //
545
+ // __builtin_unreachable:
546
+ #if SPP_GCC_VERSION >= 40800
547
+ #define SPP_UNREACHABLE_RETURN(x) __builtin_unreachable();
548
+ #endif
549
+
550
+ #ifndef SPP_COMPILER
551
+ #define SPP_COMPILER "GNU C++ version " __VERSION__
552
+ #endif
553
+
554
+ // ConceptGCC compiler:
555
+ // http://www.generic-programming.org/software/ConceptGCC/
556
+ #ifdef __GXX_CONCEPTS__
557
+ #define SPP_HAS_CONCEPTS
558
+ #define SPP_COMPILER "ConceptGCC version " __VERSION__
559
+ #endif
560
+
561
+ #elif defined _MSC_VER
562
+
563
+ #include <intrin.h> // for __popcnt()
564
+
565
+ #define SPP_POPCNT_CHECK // slower when defined, but we have to check!
566
+ #define spp_cpuid(info, x) __cpuid(info, x)
567
+
568
+ #define SPP_POPCNT __popcnt
569
+ #if (SPP_GROUP_SIZE == 64 && INTPTR_MAX == INT64_MAX)
570
+ #define SPP_POPCNT64 __popcnt64
571
+ #endif
572
+
573
+ // Attempt to suppress VC6 warnings about the length of decorated names (obsolete):
574
+ #pragma warning( disable : 4503 ) // warning: decorated name length exceeded
575
+
576
+ #define SPP_HAS_PRAGMA_ONCE
577
+ #define SPP_HAS_CSTDINT
578
+
579
+ //
580
+ // versions check:
581
+ // we don't support Visual C++ prior to version 7.1:
582
+ #if _MSC_VER < 1310
583
+ #error "Antique compiler not supported"
584
+ #endif
585
+
586
+ #if _MSC_FULL_VER < 180020827
587
+ #define SPP_NO_FENV_H
588
+ #endif
589
+
590
+ #if _MSC_VER < 1400
591
+ // although a conforming signature for swprint exists in VC7.1
592
+ // it appears not to actually work:
593
+ #define SPP_NO_SWPRINTF
594
+
595
+ // Our extern template tests also fail for this compiler:
596
+ #define SPP_NO_CXX11_EXTERN_TEMPLATE
597
+
598
+ // Variadic macros do not exist for VC7.1 and lower
599
+ #define SPP_NO_CXX11_VARIADIC_MACROS
600
+ #endif
601
+
602
+ #if _MSC_VER < 1500 // 140X == VC++ 8.0
603
+ #undef SPP_HAS_CSTDINT
604
+ #define SPP_NO_MEMBER_TEMPLATE_FRIENDS
605
+ #endif
606
+
607
+ #if _MSC_VER < 1600 // 150X == VC++ 9.0
608
+ // A bug in VC9:
609
+ #define SPP_NO_ADL_BARRIER
610
+ #endif
611
+
612
+
613
+ // MSVC (including the latest checked version) has not yet completely
614
+ // implemented value-initialization, as is reported:
615
+ // "VC++ does not value-initialize members of derived classes without
616
+ // user-declared constructor", reported in 2009 by Sylvester Hesp:
617
+ // https: //connect.microsoft.com/VisualStudio/feedback/details/484295
618
+ // "Presence of copy constructor breaks member class initialization",
619
+ // reported in 2009 by Alex Vakulenko:
620
+ // https: //connect.microsoft.com/VisualStudio/feedback/details/499606
621
+ // "Value-initialization in new-expression", reported in 2005 by
622
+ // Pavel Kuznetsov (MetaCommunications Engineering):
623
+ // https: //connect.microsoft.com/VisualStudio/feedback/details/100744
624
+ // See also: http: //www.boost.org/libs/utility/value_init.htm #compiler_issues
625
+ // (Niels Dekker, LKEB, May 2010)
626
+ #define SPP_NO_COMPLETE_VALUE_INITIALIZATION
627
+
628
+ #ifndef _NATIVE_WCHAR_T_DEFINED
629
+ #define SPP_NO_INTRINSIC_WCHAR_T
630
+ #endif
631
+
632
+ //
633
+ // check for exception handling support:
634
+ #if !defined(_CPPUNWIND) && !defined(SPP_NO_EXCEPTIONS)
635
+ #define SPP_NO_EXCEPTIONS
636
+ #endif
637
+
638
+ //
639
+ // __int64 support:
640
+ //
641
+ #define SPP_HAS_MS_INT64
642
+ #if defined(_MSC_EXTENSIONS) || (_MSC_VER >= 1400)
643
+ #define SPP_HAS_LONG_LONG
644
+ #else
645
+ #define SPP_NO_LONG_LONG
646
+ #endif
647
+
648
+ #if (_MSC_VER >= 1400) && !defined(_DEBUG)
649
+ #define SPP_HAS_NRVO
650
+ #endif
651
+
652
+ #if _MSC_VER >= 1500 // 150X == VC++ 9.0
653
+ #define SPP_HAS_PRAGMA_DETECT_MISMATCH
654
+ #endif
655
+
656
+ //
657
+ // disable Win32 API's if compiler extensions are
658
+ // turned off:
659
+ //
660
+ #if !defined(_MSC_EXTENSIONS) && !defined(SPP_DISABLE_WIN32)
661
+ #define SPP_DISABLE_WIN32
662
+ #endif
663
+
664
+ #if !defined(_CPPRTTI) && !defined(SPP_NO_RTTI)
665
+ #define SPP_NO_RTTI
666
+ #endif
667
+
668
+ //
669
+ // TR1 features:
670
+ //
671
+ #if _MSC_VER >= 1700
672
+ // #define SPP_HAS_TR1_HASH // don't know if this is true yet.
673
+ // #define SPP_HAS_TR1_TYPE_TRAITS // don't know if this is true yet.
674
+ #define SPP_HAS_TR1_UNORDERED_MAP
675
+ #define SPP_HAS_TR1_UNORDERED_SET
676
+ #endif
677
+
678
+ //
679
+ // C++0x features
680
+ //
681
+ // See above for SPP_NO_LONG_LONG
682
+
683
+ // C++ features supported by VC++ 10 (aka 2010)
684
+ //
685
+ #if _MSC_VER < 1600
686
+ #define SPP_NO_CXX11_AUTO_DECLARATIONS
687
+ #define SPP_NO_CXX11_AUTO_MULTIDECLARATIONS
688
+ #define SPP_NO_CXX11_LAMBDAS
689
+ #define SPP_NO_CXX11_RVALUE_REFERENCES
690
+ #define SPP_NO_CXX11_STATIC_ASSERT
691
+ #define SPP_NO_CXX11_DECLTYPE
692
+ #endif // _MSC_VER < 1600
693
+
694
+ #if _MSC_VER >= 1600
695
+ #define SPP_HAS_STDINT_H
696
+ #endif
697
+
698
+ // C++11 features supported by VC++ 11 (aka 2012)
699
+ //
700
+ #if _MSC_VER < 1700
701
+ #define SPP_NO_CXX11_FINAL
702
+ #endif // _MSC_VER < 1700
703
+
704
+ // C++11 features supported by VC++ 12 (aka 2013).
705
+ //
706
+ #if _MSC_FULL_VER < 180020827
707
+ #define SPP_NO_CXX11_DEFAULTED_FUNCTIONS
708
+ #define SPP_NO_CXX11_DELETED_FUNCTIONS
709
+ #define SPP_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
710
+ #define SPP_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
711
+ #define SPP_NO_CXX11_RAW_LITERALS
712
+ #define SPP_NO_CXX11_TEMPLATE_ALIASES
713
+ #define SPP_NO_CXX11_TRAILING_RESULT_TYPES
714
+ #define SPP_NO_CXX11_VARIADIC_TEMPLATES
715
+ #define SPP_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
716
+ #define SPP_NO_CXX11_DECLTYPE_N3276
717
+ #endif
718
+
719
+ // C++11 features supported by VC++ 14 (aka 2014) CTP1
720
+ #if (_MSC_FULL_VER < 190021730)
721
+ #define SPP_NO_CXX11_REF_QUALIFIERS
722
+ #define SPP_NO_CXX11_USER_DEFINED_LITERALS
723
+ #define SPP_NO_CXX11_ALIGNAS
724
+ #define SPP_NO_CXX11_INLINE_NAMESPACES
725
+ #define SPP_NO_CXX14_DECLTYPE_AUTO
726
+ #define SPP_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
727
+ #define SPP_NO_CXX14_RETURN_TYPE_DEDUCTION
728
+ #define SPP_NO_CXX11_HDR_INITIALIZER_LIST
729
+ #endif
730
+
731
+ // C++11 features not supported by any versions
732
+ #define SPP_NO_CXX11_CHAR16_T
733
+ #define SPP_NO_CXX11_CHAR32_T
734
+ #define SPP_NO_CXX11_CONSTEXPR
735
+ #define SPP_NO_SFINAE_EXPR
736
+ #define SPP_NO_TWO_PHASE_NAME_LOOKUP
737
+
738
+ // C++ 14:
739
+ #if !defined(__cpp_binary_literals) || (__cpp_binary_literals < 201304)
740
+ #define SPP_NO_CXX14_BINARY_LITERALS
741
+ #endif
742
+
743
+ #if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
744
+ #define SPP_NO_CXX14_CONSTEXPR
745
+ #endif
746
+
747
+ #if (__cplusplus < 201304) // There's no SD6 check for this....
748
+ #define SPP_NO_CXX14_DIGIT_SEPARATORS
749
+ #endif
750
+
751
+ #if !defined(__cpp_generic_lambdas) || (__cpp_generic_lambdas < 201304)
752
+ #define SPP_NO_CXX14_GENERIC_LAMBDAS
753
+ #endif
754
+
755
+ #if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
756
+ #define SPP_NO_CXX14_VARIABLE_TEMPLATES
757
+ #endif
758
+
759
+ #endif
760
+
761
+ // from boost/config/suffix.hpp
762
+ // ----------------------------
763
+ #ifndef SPP_ATTRIBUTE_UNUSED
764
+ #define SPP_ATTRIBUTE_UNUSED
765
+ #endif
766
+
767
+ /*
768
+ Try to persuade compilers to inline.
769
+ */
770
+ #ifndef SPP_FORCEINLINE
771
+ #if defined(__GNUC__)
772
+ #define SPP_FORCEINLINE __inline __attribute__ ((always_inline))
773
+ #elif defined(_MSC_VER)
774
+ #define SPP_FORCEINLINE __forceinline
775
+ #else
776
+ #define SPP_FORCEINLINE inline
777
+ #endif
778
+ #endif
779
+
780
+
781
+ #endif // spp_config_h_guard