Type traits provide information about a type.
They are used by class templates such as arbb::array, as well as generic functions, such as the dense container functions. Intel(R) Array Building Blocks (Intel(R) ArBB) provides a small set of type traits that you can use to infer information about ArBB and other types. You can specialize these type traits for your types, but this is only necessary when you write user-defined types that are intended to work in generic contexts.
You can use the arbb::captured and arbb::uncaptured type traits to write generic code that can control the capture of specific operations. For example:
// Compute a + a * b + a * b^2 + a * b^3, where b is always an // uncaptured value. template<typename T> T foo(const T& a, const arbb::uncaptured<T>& b) { typename arbb::uncaptured<T>::type b2 = b * b; typename arbb::uncaptured<T>::type b3 = b * b2; return a + a * b + a * b2 + a * b3; }
In this code example, foo<float>
is a regular function operating on float
values. foo<arbb::f32>
is a function that operates on arbb::f32 values, but performs its sub-computations on b
using plain float
values.
Classes | |
struct | arbb::boolean_type< T > |
Type trait defining the boolean type resulting from a comparison operation on objects of type T . More... | |
struct | arbb::compare_type< T > |
Type trait defining the integral type resulting from a compare() operation on objects of type T . More... | |
struct | arbb::captured< T > |
Type trait defining the captured type corresponding to a given type. More... | |
struct | arbb::uncaptured< T > |
Type trait defining the captured type corresponding to a given type. More... |
Copyright © 2010, Intel Corporation. All rights reserved.