Arcane  v4.1.0.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
common/arccore/common/ArrayTraits.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2025 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* ArrayTraits.h (C) 2000-2025 */
9/* */
10/* Caractéristiques d'un tableau 1D. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCCORE_COMMON_ARRAYTRAITS_H
13#define ARCCORE_COMMON_ARRAYTRAITS_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arccore/common/CommonGlobal.h"
18
19// Pour std::byte
20#include <cstddef>
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25namespace Arccore
26{
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
43template <typename T>
45{
46 public:
47
48 typedef const T& ConstReferenceType;
49 typedef FalseType IsPODType;
50};
51
52/*---------------------------------------------------------------------------*/
53/*---------------------------------------------------------------------------*/
54
62#define ARCCORE_DEFINE_ARRAY_PODTYPE(datatype) \
63 template <> \
64 class ArrayTraits<datatype> \
65 { \
66 public: \
67\
68 typedef datatype ConstReferenceType; \
69 typedef TrueType IsPODType; \
70 }
71
72/*---------------------------------------------------------------------------*/
73/*---------------------------------------------------------------------------*/
75template <typename T>
76class ArrayTraits<T*>
77{
78 public:
79
80 typedef T* Ptr;
81 typedef const Ptr& ConstReferenceType;
82 typedef FalseType IsPODType;
83};
84
86template <typename T>
87class ArrayTraits<const T*>
88{
89 public:
90
91 typedef T* Ptr;
92 typedef const T* ConstReferenceType;
93 typedef FalseType IsPODType;
94};
95
96/*---------------------------------------------------------------------------*/
97/*---------------------------------------------------------------------------*/
98
99ARCCORE_DEFINE_ARRAY_PODTYPE(char);
100ARCCORE_DEFINE_ARRAY_PODTYPE(signed char);
101ARCCORE_DEFINE_ARRAY_PODTYPE(unsigned char);
102ARCCORE_DEFINE_ARRAY_PODTYPE(short);
103ARCCORE_DEFINE_ARRAY_PODTYPE(int);
104ARCCORE_DEFINE_ARRAY_PODTYPE(long);
105ARCCORE_DEFINE_ARRAY_PODTYPE(unsigned short);
106ARCCORE_DEFINE_ARRAY_PODTYPE(unsigned int);
107ARCCORE_DEFINE_ARRAY_PODTYPE(unsigned long);
108ARCCORE_DEFINE_ARRAY_PODTYPE(float);
109ARCCORE_DEFINE_ARRAY_PODTYPE(double);
110ARCCORE_DEFINE_ARRAY_PODTYPE(long double);
111ARCCORE_DEFINE_ARRAY_PODTYPE(std::byte);
112ARCCORE_DEFINE_ARRAY_PODTYPE(Float16);
113ARCCORE_DEFINE_ARRAY_PODTYPE(BFloat16);
114
115/*---------------------------------------------------------------------------*/
116/*---------------------------------------------------------------------------*/
117
118} // namespace Arccore
119
120/*---------------------------------------------------------------------------*/
121/*---------------------------------------------------------------------------*/
122
123#endif
Caractéristiques pour un tableau.
Espace de nom de Arccore.
Arcane::BFloat16 BFloat16
Type 'Brain Float16'.
Arcane::Float16 Float16
Type 'Float16' (binary16)
Structure équivalente à la valeur booléenne vrai.