#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 of N equal to 8, 16, 32, or 64 bits, the equivalent canonical element type is intN_t (if T is signed) or uintN_t (if T is unsigned). Otherwise, the canonical element type is T.

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 and long are distinct types of the same size, or long and long 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 if long is 32-bit, long long if long is 64-bit) map to the same TensorStore DataType as the corresponding canonical type.