7#include <gtest/gtest.h>
9#include "arccore/collections/Array.h"
10#include "arccore/collections/IMemoryAllocator.h"
12#include "arccore/base/FatalErrorException.h"
13#include "arccore/base/Iterator.h"
15#include "TestArrayCommon.h"
18using namespace TestArccore;
22void _testArraySwap(
bool use_own_swap)
24 std::cout <<
"** TestArraySwap is_own=" << use_own_swap <<
"\n";
28 c1.setDebugName(c1_name);
30 std::cout <<
"** C1_this = " << &c1 <<
"\n";
31 std::cout <<
"** C1_BASE = " << x1 <<
"\n";
34 std::cout <<
"** C2_this = " << &c2 <<
"\n";
35 std::cout <<
"** C2_BASE = " << x2 <<
"\n";
37 ASSERT_EQ(c1.debugName(), c1_name);
38 ASSERT_EQ(c2.debugName(),
String{});
46 ASSERT_EQ(c2.debugName(), c1_name);
47 ASSERT_EQ(c1.debugName(),
String{});
51 std::cout <<
"** C1_BASE_AFTER = " << after_x1 <<
" size=" << c1.size() <<
"\n";
52 std::cout <<
"** C2_BASE_AFTER = " << after_x2 <<
" size=" << c2.size() <<
"\n";
54 ASSERT_TRUE(x1 == after_x2) <<
"Bad value after swap [1]";
55 ASSERT_TRUE(x2 == after_x1) <<
"Bad value after swap [2]";
66 _testArraySwap(
false);
72Integer IntPtrSubClass::count = 0;
77template <
typename Container,
typename SubClass>
89 ARCCORE_UT_CHECK((c.size() == 3),
"Bad size (3)");
90 ARCCORE_UT_CHECK((c[0] == 1),
"Bad value [0]");
91 ARCCORE_UT_CHECK((c[1] == 2),
"Bad value [1]");
92 ARCCORE_UT_CHECK((c[2] == 3),
"Bad value [2]");
94 ARCCORE_UT_CHECK((c.size() == 0),
"Bad size (0)");
96 ARCCORE_UT_CHECK((c.size() == 5),
"Bad size");
98 ARCCORE_UT_CHECK((c.size() == 6),
"Bad size");
99 ARCCORE_UT_CHECK((c[5] == 6),
"Bad value [5]");
101 ASSERT_EQ(c.size(), c.capacity()) <<
"Bad capacity (test 1)";
104 ASSERT_EQ(c.size(), c.capacity()) <<
"Bad capacity (test 2)";
109 ASSERT_EQ(c.capacity(), 0) <<
"Bad capacity (test 3)";
114 for (
Integer i = 0; i < nb; ++i)
117 Int64 current_capacity = c.capacity();
118 ASSERT_EQ(current_capacity, (nb * 2)) <<
"Bad capacity (test 4)";
119 c.shrink(c.capacity() + 5);
120 ASSERT_EQ(c.capacity(), current_capacity) <<
"Bad capacity (test 5)";
122 ASSERT_EQ(c.capacity(), 32) <<
"Bad capacity (test 6)";
124 ASSERT_EQ(c.capacity(), c.size()) <<
"Bad capacity (test 7)";
130 for (Container& c : uc) {
137 for (
Integer i = 0; i < 50; ++i)
138 c.add(SubClass(i + 2));
141 for (
Integer i = 50; i < 100; ++i) {
142 c2.add(SubClass(i + 2));
150 for (
Integer i = 100; i < 150; ++i) {
151 c4.add(SubClass(i + 2));
154 ARCCORE_UT_CHECK((c.size() == 150),
"Bad size (150)");
156 ARCCORE_UT_CHECK((c.capacity() == 300),
"Bad capacity (300)");
157 for (
Integer i = 0; i < 50; ++i) {
160 ARCCORE_UT_CHECK((c.size() == 100),
"Bad size (100)");
161 for (
Integer i = 0; i < 50; ++i) {
163 ARCCORE_UT_CHECK((c[i] == ((i * 2) + 3)),
"Bad value");
165 for (
Integer i = 50; i < 100; ++i) {
167 ARCCORE_UT_CHECK((c[i] == (i + 52)),
"Bad value");
175void _testArrayNewInternal()
178 std::cout <<
"** TEST VECTOR NEW\n";
187 std::cout <<
"** TEST VECTOR NEW 2\n";
191 std::cout <<
"** COUNT = " << IntPtrSubClass::count <<
"\n";
193 std::cout <<
"** TEST VECTOR NEW 3\n";
197 std::cout <<
"** COUNT = " << IntPtrSubClass::count <<
"\n";
205 ARCCORE_UT_CHECK((c2.size() == 3),
"Bad value [3]");
206 ARCCORE_UT_CHECK((c.
size() == 2),
"Bad value [2]");
207 ARCCORE_UT_CHECK((c[0] == 5),
"Bad value [5]");
208 ARCCORE_UT_CHECK((c[1] == 7),
"Bad value [7]");
209 ARCCORE_UT_CHECK((c2[0] == 5),
"Bad value [5]");
210 ARCCORE_UT_CHECK((c2[1] == 7),
"Bad value [7]");
211 ARCCORE_UT_CHECK((c2[2] == 3),
"Bad value [7]");
219 ARCCORE_UT_CHECK((c2.size() == 3),
"Bad value [3]");
220 ARCCORE_UT_CHECK((c.
size() == 2),
"Bad value [2]");
221 ARCCORE_UT_CHECK((c[0] == 5),
"Bad value [5]");
222 ARCCORE_UT_CHECK((c[1] == 7),
"Bad value [7]");
223 ARCCORE_UT_CHECK((c2[0] == 5),
"Bad value [5]");
224 ARCCORE_UT_CHECK((c2[1] == 7),
"Bad value [7]");
225 ARCCORE_UT_CHECK((c2[2] == 3),
"Bad value [7]");
231 ARCCORE_UT_CHECK((c2.size() == 3),
"Bad value [3]");
232 ARCCORE_UT_CHECK((c.
size() == 2),
"Bad value [2]");
233 ARCCORE_UT_CHECK((c[0] == 5),
"Bad value [5]");
234 ARCCORE_UT_CHECK((c[1] == 7),
"Bad value [7]");
235 ARCCORE_UT_CHECK((c2[0] == 5),
"Bad value [5]");
236 ARCCORE_UT_CHECK((c2[1] == 7),
"Bad value [7]");
237 ARCCORE_UT_CHECK((c2[2] == 3),
"Bad value [7]");
241 ARCCORE_UT_CHECK((c.
size() == 2),
"Bad value [2]");
242 ARCCORE_UT_CHECK((c[0] == 5),
"Bad value [5]");
243 ARCCORE_UT_CHECK((c[1] == 7),
"Bad value [7]");
247 ARCCORE_UT_CHECK((c.
size() == 2),
"Bad value [2]");
248 ARCCORE_UT_CHECK((c[0] == 5),
"Bad value [5]");
249 ARCCORE_UT_CHECK((c[1] == 7),
"Bad value [7]");
255 ARCCORE_UT_CHECK((cx.size() == 5),
"Bad value [5]");
260 ARCCORE_UT_CHECK((c2.size() == 3),
"Bad value [3]");
261 ARCCORE_UT_CHECK((c.
size() == 2),
"Bad value [2]");
262 ARCCORE_UT_CHECK((c[0] == 5),
"Bad value [5]");
263 ARCCORE_UT_CHECK((c[1] == 7),
"Bad value [7]");
264 ARCCORE_UT_CHECK((c2[0] == 5),
"Bad value [5]");
265 ARCCORE_UT_CHECK((c2[1] == 7),
"Bad value [7]");
266 ARCCORE_UT_CHECK((c2[2] == 3),
"Bad value [7]");
267 for (
Integer i = 0; i < 50; ++i)
277 ASSERT_EQ(c22.size(),33);
287 ASSERT_EQ(c2.
size(),c3.size());
288 ASSERT_EQ(c2.
size(),c4.size());
290 ASSERT_EQ(c2.
size(),c3.size());
291 ASSERT_EQ(c2.
size(),c4.size());
296 ARCCORE_UT_CHECK((c2.
size() == 33),
"Bad value [3]");
297 ARCCORE_UT_CHECK((c2[0] == 5),
"Bad value [5]");
298 ARCCORE_UT_CHECK((c2[1] == 7),
"Bad value [7]");
299 ARCCORE_UT_CHECK((c2[32] == 3),
"Bad value [7]");
301 ASSERT_EQ(c2.
size(),1293);
302 ASSERT_EQ(c22.size(),2);
306 ASSERT_EQ(values1.
size(),3);
307 ASSERT_EQ(values1[0],-7);
308 ASSERT_EQ(values1[1],3);
309 ASSERT_EQ(values1[2],4);
310 values1 = { 2, -1, 9, 13 };
311 ASSERT_EQ(values1.
size(),4);
312 ASSERT_EQ(values1[0],2);
313 ASSERT_EQ(values1[1],-1);
314 ASSERT_EQ(values1[2],9);
315 ASSERT_EQ(values1[3],13);
317 ASSERT_EQ(values2,values1);
320 ASSERT_EQ(values1.
size(),0);
321 ASSERT_EQ(values2.
size(),0);
329 std::copy(std::begin(values2), std::end(values2), std::back_inserter(values1));
330 std::cout <<
"** VALUES1 = " << values1 <<
"\n";
331 ARCCORE_UT_CHECK((values1.size() == 5),
"BI: Bad size");
332 ARCCORE_UT_CHECK((values1[0] == 2),
"BI: Bad value [0]");
333 ARCCORE_UT_CHECK((values1[1] == 5),
"BI: Bad value [1]");
334 ARCCORE_UT_CHECK((values1[2] == 4),
"BI: Bad value [2]");
335 ARCCORE_UT_CHECK((values1[3] == 9),
"BI: Bad value [3]");
336 ARCCORE_UT_CHECK((values1[4] == 7),
"BI: Bad value [4]");
342 std::cout <<
"V=" << i->m_v <<
" " << ci->m_v <<
'\n';
345 ASSERT_EQ(values1.size(),2);
346 ASSERT_EQ(values1[0],-7);
347 ASSERT_EQ(values1[1],3);
350 ASSERT_EQ(values1.size(),0);
356 values1.
copy(values2);
357 std::cout <<
"** VALUES1 = " << values1 <<
"\n";
358 ARCCORE_UT_CHECK((values1.size() == 5),
"BI: Bad size");
359 ARCCORE_UT_CHECK((values1[0] == 4),
"BI2: Bad value [0]");
360 ARCCORE_UT_CHECK((values1[1] == 9),
"BI2: Bad value [1]");
361 ARCCORE_UT_CHECK((values1[2] == 7),
"BI2: Bad value [2]");
362 ARCCORE_UT_CHECK((values1[3] == 6),
"BI2: Bad value [3]");
363 ARCCORE_UT_CHECK((values1[4] == 3),
"BI2: Bad value [4]");
369 std::cout <<
"V=" << i->m_v <<
" " << ci->m_v <<
'\n';
376 std::cout <<
"V=" << i->m_v <<
" " << ci->m_v <<
'\n';
379 std::cout <<
"V=" << cicvx->m_v <<
'\n';
387 std::cout <<
"V=" << i->m_v <<
" " << ci->m_v <<
" " << (iend - i) <<
'\n';
390 std::cout <<
"V=" << cicvx->m_v <<
'\n';
391 std::copy(std::begin(vx), std::end(vx), std::begin(vx));
396 std::cout << *i <<
'\n';
399 std::cout << *i <<
'\n';
401 for (
auto i : values.
range()) {
402 std::cout << i <<
'\n';
404 for (
auto i : values.
constView().range()) {
405 std::cout << i <<
'\n';
409 auto r1 = std::make_reverse_iterator(values.
end());
410 auto r2 = std::make_reverse_iterator(values.
begin());
411 for (; r1 != r2; ++r1) {
412 std::cout <<
"RVALUE = " << *r1 <<
'\n';
416 auto r1 = values.
rbegin();
429 ARCCORE_UT_CHECK((c2.
size() == 3),
"Bad value [3]");
430 ARCCORE_UT_CHECK((c.
size() == 2),
"Bad value [2]");
431 ARCCORE_UT_CHECK((c[0] == 5),
"Bad value [5]");
432 ARCCORE_UT_CHECK((c[1] == 7),
"Bad value [7]");
433 ARCCORE_UT_CHECK((c2[0] == 5),
"Bad value [5]");
434 ARCCORE_UT_CHECK((c2[1] == 7),
"Bad value [7]");
435 ARCCORE_UT_CHECK((c2[2] == 3),
"Bad value [7]");
452 _testArrayNewInternal();
455 std::cerr <<
"Exception ex=" << ex <<
"\n";
484 ASSERT_EQ(v[0], 1.2);
485 ASSERT_EQ(v[1], -1.3);
486 ASSERT_EQ(v.
at(2), 7.6);
490 std::cout <<
" Value: " << x <<
'\n';
492 v.printInfos(std::cout);
499 v.printInfos(std::cout);
503 v.printInfos(std::cout);
505 v.printInfos(std::cout);
510 v.printInfos(std::cout);
512 std::cout <<
" Value: " << v[i] <<
'\n';
518 for (
int i = 0; i < 10; ++i)
521 std::cout <<
" Value: " << v[i] <<
'\n';
527 for (
int i = 0; i < 27500; ++i) {
531 for (
int i = 0; i < 5000; ++i) {
535 for (
int i = 0; i < 27500; ++i) {
539 std::cout <<
" ValueSize= " << v.
size() <<
" values=" << v <<
'\n';
541 for (
Integer i = 0; i < 100; ++i) {
550 std::cout <<
" Size: " << v.
size() <<
'\n';
551 ASSERT_EQ(v.
size(), 230000);
566 for (Int32 i = 0, n = v.
size(); i < n; ++i)
569 auto sub_view1 = v.
subView(50, 5);
570 ASSERT_EQ(sub_view1.data(),
nullptr);
571 ASSERT_EQ(sub_view1.size(), 0);
573 auto sub_view2 = v.
subView(2, 8);
574 ASSERT_EQ(sub_view2.size(), 8);
575 for (Int32 i = 0, n = sub_view2.size(); i < n; ++i)
576 ASSERT_EQ(sub_view2[i], v[2 + i]);
578 auto sub_view3 = v.
subView(20, 8);
579 ASSERT_EQ(sub_view3.size(), 3);
580 for (Int32 i = 0, n = sub_view3.size(); i < n; ++i)
581 ASSERT_EQ(sub_view3[i], v[20 + i]);
584 ASSERT_EQ(sub_const_view1.data(),
nullptr);
585 ASSERT_EQ(sub_const_view1.size(), 0);
588 ASSERT_EQ(sub_const_view2.size(), 8);
589 for (Int32 i = 0, n = sub_const_view2.size(); i < n; ++i)
590 ASSERT_EQ(sub_const_view2[i], v[2 + i]);
593 ASSERT_EQ(sub_const_view3.size(), 3);
594 for (Int32 i = 0, n = sub_const_view3.size(); i < n; ++i)
595 ASSERT_EQ(sub_const_view3[i], v[20 + i]);
605 NoCopyData(
const NoCopyData& x) =
delete;
608template <
typename DataType>
626 const Int32 ref_value1 = 12;
627 const Int32 ref_value2 = 7;
630 std::cout <<
"C1=" << c <<
"\n";
632 ASSERT_EQ(x, ref_value1);
635 ASSERT_EQ(c.size(), 21);
636 std::cout <<
"C2=" << c <<
"\n";
641 std::cout <<
"C4=" << c <<
"\n";
642 for (Int32 i = 9, s = c.size(); i < s; ++i)
643 ASSERT_EQ(c[i], ref_value2);
644 for (Int32 i = 9, s = c.size(); i < s; ++i)
646 for (Int32 i = 9, s = c.size(); i < s; ++i)
647 ASSERT_EQ(c[i], (i + 2));
658template<
typename ArrayType>
662 static void doTestBase()
671 std::cout <<
"Array a\n";
672 ArrayType a(allocator1);
673 ASSERT_EQ(a.allocator(),allocator1);
679 std::cout <<
"Array b\n";
680 ArrayType b(allocator2);
681 ASSERT_EQ(b.capacity(),0);
682 ASSERT_EQ(b.size(),0);
683 ASSERT_EQ(b.allocator(),allocator2);
686 ASSERT_EQ(b.size(),a.size());
687 ASSERT_EQ(b.allocator(),a.allocator());
689 std::cout <<
"Array c\n";
690 ArrayType c(a.clone());
691 ASSERT_EQ(c.allocator(),a.allocator());
692 ASSERT_EQ(c.size(),a.size());
693 ASSERT_EQ(c.constSpan(),a.constSpan());
695 std::cout <<
"Array d\n";
696 ArrayType d(allocator2,a);
697 ASSERT_EQ(d.allocator(),allocator2);
698 ASSERT_EQ(d.size(),a.size());
699 ASSERT_EQ(d.constSpan(),a.constSpan());
701 std::cout <<
"Array e\n";
702 ArrayType e(allocator2,25);
703 ASSERT_EQ(e.allocator(),allocator2);
704 ASSERT_EQ(e.size(),25);
706 ArrayType f(allocator2);
708 ASSERT_EQ(f.allocator(),e.allocator());
709 ASSERT_EQ(f.size(),e.size());
712 ASSERT_EQ(f.allocator(),e.allocator());
713 ASSERT_EQ(f.size(),e.size());
735 std::cout <<
"Sizeof(ArrayMetaData)=" <<
sizeof(
ArrayMetaData) <<
"\n";
744 std::cout <<
"Array a1\n";
746 ASSERT_EQ(a1.allocator(), allocator2);
747 ASSERT_EQ(a1.size(), 0);
748 ASSERT_EQ(a1.capacity(), 0);
749 ASSERT_EQ(a1.data(),
nullptr);
751 std::cout <<
"Array a2\n";
753 ASSERT_EQ(a1.allocator(), a2.allocator());
754 ASSERT_EQ(a2.capacity(), 0);
755 ASSERT_EQ(a2.data(),
nullptr);
762 ASSERT_EQ(a1.size(), 5);
764 std::cout <<
"Array a3\n";
769 ASSERT_EQ(a3.size(), 3);
771 ASSERT_EQ(a3.allocator(), a1.allocator());
772 ASSERT_EQ(a3.size(), a1.size());
773 ASSERT_EQ(a3.constSpan(), a1.constSpan());
775 std::cout <<
"Array a4\n";
780 ASSERT_EQ(a4.size(), 3);
782 ASSERT_EQ(a4.allocator(), allocator1);
791 ASSERT_EQ(array[0].allocator(), allocator3);
792 ASSERT_EQ(array[1].allocator(), allocator3);
803 std::cout <<
"Sizeof(ArrayMetaData)=" <<
sizeof(
ArrayMetaData) <<
"\n";
812 std::cout <<
"Array a1\n";
814 ASSERT_EQ(a1.allocator(), allocator2);
815 ASSERT_EQ(a1.size(), 0);
816 ASSERT_EQ(a1.capacity(), 0);
817 ASSERT_EQ(a1.data(),
nullptr);
819 std::cout <<
"Array a2\n";
821 ASSERT_EQ(a1.allocator(), a2.allocator());
822 ASSERT_EQ(a2.capacity(), 0);
823 ASSERT_EQ(a2.data(),
nullptr);
830 ASSERT_EQ(a1.size(), 5);
832 std::cout <<
"Array a3\n";
837 ASSERT_EQ(a3.size(), 3);
839 ASSERT_EQ(a3.allocator(), a1.allocator());
840 ASSERT_EQ(a3.size(), a1.size());
841 ASSERT_EQ(a3.constSpan(), a1.constSpan());
843 std::cout <<
"Array a4\n";
845 ASSERT_EQ(a4.size(), 2);
849 ASSERT_EQ(a4.size(), 5);
855 ASSERT_EQ(a4.allocator(), allocator1);
861 for (
Integer i = 0; i < 2; ++i) {
864 ASSERT_EQ(array[0].allocator(), allocator3);
865 ASSERT_EQ(array[1].allocator(), allocator3);
877:
public IMemoryAllocator3
884 return m_default_allocator.hasRealloc(args);
889 return m_default_allocator.allocate(args,new_size);
894 return m_default_allocator.reallocate(args, current_ptr, new_size);
899 m_default_allocator.deallocate(args, ptr);
901 Int64 adjustedCapacity(
MemoryAllocationArgs args, Int64 wanted_capacity, Int64 element_size)
const override
904 return m_default_allocator.adjustedCapacity(args, wanted_capacity, element_size);
909 return m_default_allocator.guaranteedAlignment(args);
917 ASSERT_EQ(ptr.
size(), 8);
918 m_default_allocator.notifyMemoryArgsChanged(old_args, new_args, ptr);
923 DefaultMemoryAllocator3 m_default_allocator;
932 bool is_valid = v1 || v2 || v3;
937#define ASSERT_SAME_ARRAY_INFOS(a,b) \
938 ASSERT_EQ(a.allocationOptions(), b.allocationOptions());\
939 ASSERT_EQ(a.size(), b.size());\
940 ASSERT_EQ(a.capacity(), b.capacity())
942TEST(
Array, AllocatorV2)
952 ASSERT_EQ(opt3, allocate_options1);
955 std::cout <<
"Array a1\n";
957 ASSERT_EQ(a1.allocationOptions(), allocate_options2);
958 ASSERT_EQ(a1.size(), 0);
959 ASSERT_EQ(a1.capacity(), 0);
960 ASSERT_EQ(a1.data(),
nullptr);
962 std::cout <<
"Array a2\n";
964 ASSERT_SAME_ARRAY_INFOS(a2, a1);
965 ASSERT_EQ(a2.data(),
nullptr);
972 ASSERT_EQ(a1.size(), 5);
978 std::cout <<
"Array a3\n";
983 ASSERT_EQ(a3.size(), 3);
985 ASSERT_EQ(a3.allocator(), a1.allocator());
986 ASSERT_EQ(a3.size(), a1.size());
987 ASSERT_EQ(a3.constSpan(), a1.constSpan());
989 std::cout <<
"Array a4\n";
994 ASSERT_EQ(a4.size(), 3);
996 ASSERT_EQ(a4.allocationOptions(), allocate_options1);
1002 for (
Integer i = 0; i < 2; ++i) {
1005 ASSERT_EQ(array[0].allocationOptions(), allocator3);
1006 ASSERT_EQ(array[1].allocationOptions(), allocator3);
1013TEST(
Array, DebugInfo)
1016 DefaultMemoryAllocator3 m_default_allocator;
1019 String a1_name(
"Array1");
1020 String sa1_name(
"SharedArray1");
1023 std::cout <<
"Array a1\n";
1025 a1.setDebugName(a1_name);
1026 ASSERT_EQ(a1.allocationOptions(), allocate_options2);
1027 ASSERT_EQ(a1.size(), 0);
1028 ASSERT_EQ(a1.capacity(), 0);
1029 ASSERT_EQ(a1.data(),
nullptr);
1030 ASSERT_EQ(a1.debugName(), a1_name);
1032 std::cout <<
"SharedArray sa1\n";
1034 sa1.setDebugName(sa1_name);
1035 ASSERT_EQ(sa1.allocationOptions(), allocate_options2);
1036 ASSERT_EQ(sa1.size(), 0);
1037 ASSERT_EQ(sa1.capacity(), 0);
1038 ASSERT_EQ(sa1.data(),
nullptr);
1039 ASSERT_EQ(sa1.debugName(), sa1_name);
1041 ASSERT_EQ(a1.debugName(), a1_name);
1043 std::cout <<
"Array a2\n";
1045 ASSERT_SAME_ARRAY_INFOS(a2, a1);
1046 ASSERT_EQ(a2.data(),
nullptr);
1047 ASSERT_EQ(a2.debugName(), a1_name);
1054 ASSERT_EQ(a1.size(), 5);
1057 ASSERT_EQ(a2.debugName(), a1_name);
1058 ASSERT_EQ(a2.size(), 2);
1063 ASSERT_EQ(a3.
size(), 2);
1069TEST(Collections, Memory)
#define ASSERT_TRUE(condition)
Vérifie que condition est vrai.
String debugName() const
Nom de debug (nul si aucun nom spécifié)
Classe abstraite de base d'un vecteur.
void _internalSetHostDeviceMemoryLocation(eHostDeviceMemoryLocation location)
Positionne l'emplacement physique de la zone mémoire.
Integer size() const
Nombre d'éléments du vecteur.
eHostDeviceMemoryLocation hostDeviceMemoryLocation() const
Positionne l'emplacement physique de la zone mémoire.
static constexpr Integer simdAlignment()
Alignement pour les structures utilisant la vectorisation.
static AlignedMemoryAllocator * Simd()
Allocateur garantissant l'alignement pour utiliser la vectorisation sur la plateforme cible.
Informations sur une zone mémoire allouée.
Int64 size() const
Taille en octets de la zone mémoire utilisée. (-1) si inconnue.
ConstIterT< ArrayView< T > > const_iter
Type d'un itérateur constant sur tout le tableau.
Tableau d'items de types quelconques.
iterator end()
Itérateur sur le premier élément après la fin du tableau.
ConstArrayView< T > constView() const
Vue constante sur ce tableau.
void remove(Int64 index)
Supprime l'entité ayant l'indice index.
void resize(Int64 s)
Change le nombre d'éléments du tableau à s.
ArrayView< T > subView(Int64 abegin, Integer asize)
Sous-vue à partir de l'élément abegin et contenant asize éléments.
void reserve(Int64 new_capacity)
Réserve le mémoire pour new_capacity éléments.
reverse_iterator rbegin()
Itérateur inverse sur le premier élément du tableau.
T & at(Int64 i)
Elément d'indice i. Vérifie toujours les débordements.
void resizeNoInit(Int64 s)
Redimensionne sans initialiser les nouvelles valeurs.
ConstArrayView< T > subConstView(Int64 abegin, Int32 asize) const
Sous-vue à partir de l'élément abegin et contenant asize éléments.
SmallSpan< const T > smallSpan() const
Vue immutable sur ce tableau.
SmallSpan< const T > constSmallSpan() const
Vue immutable sur ce tableau.
void copy(Span< const T > rhs)
Copie les valeurs de rhs dans l'instance.
ArrayView< T > view() const
Vue mutable sur ce tableau.
Span< const T > span() const
Vue immutable sur ce tableau.
reverse_iterator rend()
Itérateur inverse sur le premier élément après la fin du tableau.
iterator begin()
Itérateur sur le premier élément du tableau.
Span< const T > constSpan() const
Vue constante sur ce tableau.
ArrayRange< pointer > range()
Intervalle d'itération du premier au dernièr élément.
void add(ConstReferenceType val)
Ajoute l'élément val à la fin du tableau.
ConstIterT< ConstArrayView< T > > const_iter
Type d'un itérateur constant sur tout le tableau.
Classe de base d'une exception.
Interface d'un allocateur pour la mémoire.
Classe contenant des informations pour spécialiser les allocations.
Options pour configurer les allocations.
Allocateur mémoire via malloc/realloc/free avec impression listing.
Vecteur 1D de données avec sémantique par référence.
SharedArray< T > clone() const
Clone le tableau.
Vue d'un tableau d'éléments de type T.
Chaîne de caractères unicode.
Vecteur 1D de données avec sémantique par valeur (style STL).
Allocateur pour tester les arguments.
Concept for allocating, resizing and freeing memory block.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Int32 Integer
Type représentant un entier.
@ MainlyHost
Indique que la donnée sera plutôt utilisée sur CPU.
@ HostAndDeviceMostlyRead
Indique que la donnée sera utilisée à la fois sur accélérateur et sur CPU et qu'elle ne sera pas souv...
void swap(UniqueArray< T > &v1, UniqueArray< T > &v2)
Échange les valeurs de v1 et v2.
@ Unknown
Localisation inconnue.
@ ManagedMemoryDevice
La mémoire est de la mémoire managée sur accélérateur.
@ Host
La mémoire est sur l'hôte.
@ ManagedMemoryHost
La mémoire est de la mémoire managée sur l'hôte.
@ Device
La mémoire est sur accélérateur.
@ HostPinned
Alloue sur l'hôte.
@ Unknown
Valeur inconnue ou non initialisée.
@ UnifiedMemory
Alloue en utilisant la mémoire unifiée.
@ Device
Alloue sur le device.
Espace de nom de Arccore.