-
#include "tensorstore/data_type.h"
-
template <typename T>
using tensorstore::CanonicalElementType; Metafunction that maps an unqualified type
T
to the equivalent canonical element type, if there is one.If
T
is an integer type ofN
equal to 8, 16, 32, or 64 bits, the equivalent canonical element type isintN_t
(ifT
is signed) oruintN_t
(ifT
is unsigned). Otherwise, the canonical element type isT
.On all common platforms:
signed char == int8_t short == int16_t int == int32_t
However,
long
may be 32-bit (all 32-bit platforms, and 64-bit Windows) or 64-bit (Linux/Mac OS X 64-bit).The
long long
type is always 64-bit.Therefore, depending on the platform, either
int
andlong
are distinct types of the same size, orlong
andlong long
are distinct types of the same size.TensorStore data types are defined by size, but also have a corresponding canonical C++ type. In order to allow
int
,long
,long long
to be used with TensorStore, this metafunction is used to ensure that non-canonical types (long
iflong
is 32-bit,long long
iflong
is 64-bit) map to the same TensorStoreDataType
as the corresponding canonical type.