21 #ifndef __TBB_tbb_stddef_H 22 #define __TBB_tbb_stddef_H 25 #define TBB_VERSION_MAJOR 4 26 #define TBB_VERSION_MINOR 4 29 #define TBB_INTERFACE_VERSION 9005 30 #define TBB_INTERFACE_VERSION_MAJOR TBB_INTERFACE_VERSION/1000 34 #define TBB_COMPATIBLE_INTERFACE_VERSION 2 36 #define __TBB_STRING_AUX(x) #x 37 #define __TBB_STRING(x) __TBB_STRING_AUX(x) 40 #if !defined RC_INVOKED 95 #include "tbb_config.h" 98 #define __TBB_EXPORTED_FUNC __cdecl 99 #define __TBB_EXPORTED_METHOD __thiscall 101 #define __TBB_EXPORTED_FUNC 102 #define __TBB_EXPORTED_METHOD 105 #if __INTEL_COMPILER || _MSC_VER 106 #define __TBB_NOINLINE(decl) __declspec(noinline) decl 108 #define __TBB_NOINLINE(decl) decl __attribute__ ((noinline)) 110 #define __TBB_NOINLINE(decl) decl 113 #if __TBB_NOEXCEPT_PRESENT 114 #define __TBB_NOEXCEPT(expression) noexcept(expression) 116 #define __TBB_NOEXCEPT(expression) 122 #define __TBB_tbb_windef_H 123 #include "internal/_tbb_windef.h" 124 #undef __TBB_tbb_windef_H 126 #if !defined(_MSC_VER) || _MSC_VER>=1600 131 typedef void(*assertion_handler_type)(
const char* filename,
int line,
const char* expression,
const char * comment );
133 #if __TBBMALLOC_BUILD 134 namespace rml {
namespace internal {
135 #define __TBB_ASSERT_RELEASE(predicate,message) ((predicate)?((void)0) : rml::internal::assertion_failure(__FILE__,__LINE__,#predicate,message)) 138 #define __TBB_ASSERT_RELEASE(predicate,message) ((predicate)?((void)0) : tbb::assertion_failure(__FILE__,__LINE__,#predicate,message)) 142 assertion_handler_type __TBB_EXPORTED_FUNC
set_assertion_handler( assertion_handler_type new_handler );
148 void __TBB_EXPORTED_FUNC
assertion_failure(
const char* filename,
int line,
const char* expression,
const char* comment );
150 #if __TBBMALLOC_BUILD 162 #define __TBB_ASSERT(predicate,message) __TBB_ASSERT_RELEASE(predicate,message) 164 #define __TBB_ASSERT_EX __TBB_ASSERT 169 #define __TBB_ASSERT(predicate,comment) ((void)0) 170 #define __TBB_ASSERT_EX(predicate,comment) ((void)(1 && (predicate))) 179 #if _MSC_VER && _MSC_VER<1600 180 typedef __int8 int8_t;
181 typedef __int16 int16_t;
182 typedef __int32 int32_t;
183 typedef __int64 int64_t;
184 typedef unsigned __int8 uint8_t;
185 typedef unsigned __int16 uint16_t;
186 typedef unsigned __int32 uint32_t;
187 typedef unsigned __int64 uint64_t;
201 using std::ptrdiff_t;
220 const size_t NFS_MaxLineSize = 128;
241 #define __TBB_atomic // intentionally empty, see above 243 template<
class T,
size_t S,
size_t R>
244 struct padded_base : T {
247 template<
class T,
size_t S>
struct padded_base<T, S, 0> : T {};
250 template<
class T,
size_t S = NFS_MaxLineSize>
251 struct padded : padded_base<T, S, sizeof(T) % S> {};
256 #define __TBB_offsetof(class_name, member_name) \ 257 ((ptrdiff_t)&(reinterpret_cast<class_name*>(0x1000)->member_name) - 0x1000) 260 #define __TBB_get_object_ref(class_name, member_name, member_addr) \ 261 (*reinterpret_cast<class_name*>((char*)member_addr - __TBB_offsetof(class_name, member_name))) 264 void __TBB_EXPORTED_FUNC handle_perror(
int error_code,
const char* aux_info );
266 #if TBB_USE_EXCEPTIONS 267 #define __TBB_TRY try 268 #define __TBB_CATCH(e) catch(e) 269 #define __TBB_THROW(e) throw e 270 #define __TBB_RETHROW() throw 272 inline bool __TBB_false() {
return false; }
274 #define __TBB_CATCH(e) if ( tbb::internal::__TBB_false() ) 275 #define __TBB_THROW(e) ((void)0) 276 #define __TBB_RETHROW() ((void)0) 280 void __TBB_EXPORTED_FUNC runtime_warning(
const char* format, ... );
283 static void*
const poisoned_ptr =
reinterpret_cast<void*
>(-1);
288 inline void poison_pointer( T* __TBB_atomic & p ) { p =
reinterpret_cast<T*
>(poisoned_ptr); }
292 inline bool is_poisoned( T* p ) {
return p ==
reinterpret_cast<T*
>(poisoned_ptr); }
295 inline void poison_pointer( T* __TBB_atomic & ) {}
303 template<
typename T,
typename U>
304 inline T punned_cast( U* ptr ) {
305 uintptr_t x =
reinterpret_cast<uintptr_t
>(ptr);
306 return reinterpret_cast<T
>(x);
312 void operator=(
const no_assign& );
321 class no_copy: no_assign {
323 no_copy(
const no_copy& );
329 #if TBB_DEPRECATED_MUTEX_COPYING 330 class mutex_copy_deprecated_and_disabled {};
334 class mutex_copy_deprecated_and_disabled : no_copy {};
339 inline bool is_aligned(T* pointer, uintptr_t alignment) {
340 return 0==((uintptr_t)pointer & (alignment-1));
344 template<
typename integer_type>
345 inline bool is_power_of_two(integer_type arg) {
346 return arg && (0 == (arg & (arg - 1)));
350 template<
typename argument_
integer_type,
typename divisor_
integer_type>
351 inline argument_integer_type modulo_power_of_two(argument_integer_type arg, divisor_integer_type divisor) {
352 __TBB_ASSERT( is_power_of_two(divisor),
"Divisor should be a power of two" );
353 return (arg & (divisor - 1));
360 template<
typename argument_
integer_type,
typename power2_
integer_type>
361 inline bool is_power_of_two_at_least(argument_integer_type arg, power2_integer_type power2) {
362 __TBB_ASSERT( is_power_of_two(power2),
"Divisor should be a power of two" );
363 return 0 == (arg & (arg - power2));
367 template<
typename T1>
void suppress_unused_warning(
const T1& ) {}
368 template<
typename T1,
typename T2>
void suppress_unused_warning(
const T1&,
const T2& ) {}
369 template<
typename T1,
typename T2,
typename T3>
void suppress_unused_warning(
const T1&,
const T2&,
const T3& ) {}
374 struct version_tag_v3 {};
376 typedef version_tag_v3 version_tag;
395 class proportional_split: internal::no_assign {
397 proportional_split(
size_t _left = 1,
size_t _right = 1) : my_left(_left), my_right(_right) { }
399 size_t left()
const {
return my_left; }
400 size_t right()
const {
return my_right; }
403 operator split()
const {
return split(); }
405 #if __TBB_ENABLE_RANGE_FEEDBACK 406 void set_proportion(
size_t _left,
size_t _right) {
412 size_t my_left, my_right;
420 #if __TBB_ALLOCATOR_TRAITS_PRESENT 424 #if __TBB_CPP11_RVALUE_REF_PRESENT || _LIBCPP_VERSION 433 struct allocator_type {
434 typedef T value_type;
440 struct allocator_type<const T> {
441 typedef T value_type;
448 struct bool_constant {
449 static const bool value = v;
451 typedef bool_constant<true> true_type;
452 typedef bool_constant<false> false_type;
454 #if __TBB_ALLOCATOR_TRAITS_PRESENT 455 using std::allocator_traits;
457 template<
typename allocator>
458 struct allocator_traits{
459 typedef tbb::internal::false_type propagate_on_container_move_assignment;
464 template <
unsigned u,
unsigned long long ull >
465 struct select_size_t_constant {
468 static const size_t value = (size_t)((
sizeof(
size_t)==
sizeof(u)) ? u : ull);
471 #if __TBB_CPP11_RVALUE_REF_PRESENT 474 #elif defined(_LIBCPP_NAMESPACE) 476 using std::_LIBCPP_NAMESPACE::move;
477 using std::_LIBCPP_NAMESPACE::forward;
480 template <
typename T>
481 T& move( T& x ) {
return x; }
482 template <
typename T>
483 T& forward( T& x ) {
return x; }
487 #if __TBB_CPP11_RVALUE_REF_PRESENT 488 #define __TBB_FORWARDING_REF(A) A&& 492 #define __TBB_FORWARDING_REF(A) A& 494 #if __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT 495 #define __TBB_PARAMETER_PACK ... 496 #define __TBB_PACK_EXPANSION(A) A... 498 #define __TBB_PARAMETER_PACK 499 #define __TBB_PACK_EXPANSION(A) A 502 #if __TBB_CPP11_DECLTYPE_PRESENT 503 #if __TBB_CPP11_DECLVAL_BROKEN 505 template <
class T> __TBB_FORWARDING_REF(T) declval() ;
511 template <
bool condition>
512 struct STATIC_ASSERTION_FAILED;
515 struct STATIC_ASSERTION_FAILED<false> {
enum {value=1};};
518 struct STATIC_ASSERTION_FAILED<true>;
523 #if __TBB_STATIC_ASSERT_PRESENT 524 #define __TBB_STATIC_ASSERT(condition,msg) static_assert(condition,msg) 527 #define __TBB_STATIC_ASSERT_IMPL1(condition,msg,line) \ 528 enum {static_assert_on_line_##line = tbb::internal::STATIC_ASSERTION_FAILED<!(condition)>::value} 530 #define __TBB_STATIC_ASSERT_IMPL(condition,msg,line) __TBB_STATIC_ASSERT_IMPL1(condition,msg,line) 531 #define __TBB_STATIC_ASSERT(condition,msg) __TBB_STATIC_ASSERT_IMPL(condition,msg,__LINE__) int __TBB_EXPORTED_FUNC TBB_runtime_interface_version()
The function returns the interface version of the TBB shared library being used.
void __TBB_EXPORTED_FUNC assertion_failure(const char *filename, int line, const char *expression, const char *comment)
Process an assertion failure.
Definition: _flow_graph_async_msg_impl.h:32
The namespace tbb contains all components of the library.
Definition: parallel_for.h:44
assertion_handler_type __TBB_EXPORTED_FUNC set_assertion_handler(assertion_handler_type new_handler)
Set assertion handler and return previous value of it.