Debian Codegraph @

pypy/module/_cppyy/test/datatypes.h

raw symbols SCIP
1 #ifndef CPPYY_TEST_DATATYPES_H
2 #define CPPYY_TEST_DATATYPES_H
3
4 #ifdef _WIN32
5 typedef __int64 Long64_t;
6 typedef unsigned __int64 ULong64_t;
7 #else
8 typedef long long Long64_t;
9 typedef unsigned long long ULong64_t;
10 #endif
11 #include <cstddef>
12 #include <cstdint>
13 #include <complex>
14 #include <functional>
15 #include <memory>
16 #include <vector>
17 #include <wchar.h>
18 #include <sys/types.h>
19
20 const int N = 5;
21
22
23 //===========================================================================
24 struct CppyyTestPod {
25 int m_int;
26 double m_double;
27 };
28
29
30 //===========================================================================
31 enum EFruit {kApple=78, kBanana=29, kCitrus=34};
32 extern std::vector<EFruit> vecFruits;
33
34
35 //===========================================================================
36 enum class NamedClassEnum { E1 = 42 };
37
38 namespace EnumSpace {
39 enum E {E1 = 1, E2};
40 class EnumClass {
41 public:
42 enum {E1 = -1};
43 enum EE {E2 = -1};
44 };
45
46 typedef enum { AA = 1, BB, CC, DD } letter_code;
47
48 enum class NamedClassEnum { E1 = -42 };
49 }
50
51
52 //===========================================================================
53 class FourVector {
54 public:
55 FourVector(double x, double y, double z, double t) :
56 m_cc_called(false), m_x(x), m_y(y), m_z(z), m_t(t) {}
57 FourVector(const FourVector& s) :
58 m_cc_called(true), m_x(s.m_x), m_y(s.m_y), m_z(s.m_z), m_t(s.m_t) {}
59
60 double operator[](int i) {
61 if (i == 0) return m_x;
62 if (i == 1) return m_y;
63 if (i == 2) return m_z;
64 if (i == 3) return m_t;
65 return -1;
66 }
67
68 bool operator==(const FourVector& o) {
69 return (m_x == o.m_x && m_y == o.m_y &&
70 m_z == o.m_z && m_t == o.m_t);
71 }
72
73 public:
74 bool m_cc_called;
75
76 private:
77 double m_x, m_y, m_z, m_t;
78 };
79
80
81 //===========================================================================
82 typedef std::complex<double> complex_t; // maps to Py_complex
83 typedef std::complex<int> icomplex_t; // no equivalent
84
85 class CppyyTestData {
86 public:
87 CppyyTestData();
88 ~CppyyTestData();
89
90 // special cases
91 enum EWhat { kNothing=6, kSomething=111, kLots=42 };
92
93 // helper
94 void destroy_arrays();
95
96 // getters
97 bool get_bool();
98 char get_char();
99 signed char get_schar();
100 unsigned char get_uchar();
101 wchar_t get_wchar();
102 char16_t get_char16();
103 char32_t get_char32();
104 #if __cplusplus > 201402L
105 std::byte get_byte();
106 #endif
107 int8_t get_int8();
108 uint8_t get_uint8();
109 short get_short();
110 unsigned short get_ushort();
111 int get_int();
112 unsigned int get_uint();
113 long get_long();
114 unsigned long get_ulong();
115 long long get_llong();
116 unsigned long long get_ullong();
117 Long64_t get_long64();
118 ULong64_t get_ulong64();
119 float get_float();
120 double get_double();
121 long double get_ldouble();
122 long double get_ldouble_def(long double ld = 1);
123 complex_t get_complex();
124 icomplex_t get_icomplex();
125 EWhat get_enum();
126 void* get_voidp();
127
128 bool* get_bool_array();
129 bool* get_bool_array2();
130 signed char* get_schar_array();
131 signed char* get_schar_array2();
132 unsigned char* get_uchar_array();
133 unsigned char* get_uchar_array2();
134 #if __cplusplus > 201402L
135 std::byte* get_byte_array();
136 std::byte* get_byte_array2();
137 #endif
138 short* get_short_array();
139 short* get_short_array2();
140 unsigned short* get_ushort_array();
141 unsigned short* get_ushort_array2();
142 int* get_int_array();
143 int* get_int_array2();
144 unsigned int* get_uint_array();
145 unsigned int* get_uint_array2();
146 long* get_long_array();
147 long* get_long_array2();
148 unsigned long* get_ulong_array();
149 unsigned long* get_ulong_array2();
150
151 float* get_float_array();
152 float* get_float_array2();
153 double* get_double_array();
154 double* get_double_array2();
155 complex_t* get_complex_array();
156 complex_t* get_complex_array2();
157
158 CppyyTestPod get_pod_val(); // for m_pod
159 CppyyTestPod* get_pod_val_ptr();
160 CppyyTestPod& get_pod_val_ref();
161 CppyyTestPod*& get_pod_ptrref();
162
163 CppyyTestPod* get_pod_ptr(); // for m_ppod
164
165 // getters const-ref
166 const bool& get_bool_cr();
167 const char& get_char_cr();
168 const signed char& get_schar_cr();
169 const unsigned char& get_uchar_cr();
170 const wchar_t& get_wchar_cr();
171 const char16_t& get_char16_cr();
172 const char32_t& get_char32_cr();
173 #if __cplusplus > 201402L
174 const std::byte& get_byte_cr();
175 #endif
176 const int8_t& get_int8_cr();
177 const uint8_t& get_uint8_cr();
178 const short& get_short_cr();
179 const unsigned short& get_ushort_cr();
180 const int& get_int_cr();
181 const unsigned int& get_uint_cr();
182 const long& get_long_cr();
183 const unsigned long& get_ulong_cr();
184 const long long& get_llong_cr();
185 const unsigned long long& get_ullong_cr();
186 const Long64_t& get_long64_cr();
187 const ULong64_t& get_ulong64_cr();
188 const float& get_float_cr();
189 const double& get_double_cr();
190 const long double& get_ldouble_cr();
191 const complex_t& get_complex_cr();
192 const icomplex_t& get_icomplex_cr();
193 const EWhat& get_enum_cr();
194
195 // getters ref
196 bool& get_bool_r();
197 char& get_char_r();
198 signed char& get_schar_r();
199 unsigned char& get_uchar_r();
200 wchar_t& get_wchar_r();
201 char16_t& get_char16_r();
202 char32_t& get_char32_r();
203 #if __cplusplus > 201402L
204 std::byte& get_byte_r();
205 #endif
206 int8_t& get_int8_r();
207 uint8_t& get_uint8_r();
208 short& get_short_r();
209 unsigned short& get_ushort_r();
210 int& get_int_r();
211 unsigned int& get_uint_r();
212 long& get_long_r();
213 unsigned long& get_ulong_r();
214 long long& get_llong_r();
215 unsigned long long& get_ullong_r();
216 Long64_t& get_long64_r();
217 ULong64_t& get_ulong64_r();
218 float& get_float_r();
219 double& get_double_r();
220 long double& get_ldouble_r();
221 complex_t& get_complex_r();
222 icomplex_t& get_icomplex_r();
223 EWhat& get_enum_r();
224
225 // setters
226 void set_bool(bool);
227 void set_char(char);
228 void set_schar(signed char);
229 void set_uchar(unsigned char);
230 void set_wchar(wchar_t);
231 void set_char16(char16_t);
232 void set_char32(char32_t);
233 #if __cplusplus > 201402L
234 void set_byte(std::byte);
235 #endif
236 void set_int8(int8_t);
237 void set_uint8(uint8_t);
238 void set_short(short);
239 void set_ushort(unsigned short);
240 void set_int(int);
241 void set_uint(unsigned int);
242 void set_long(long);
243 void set_ulong(unsigned long);
244 void set_llong(long long);
245 void set_ullong(unsigned long long);
246 void set_long64(Long64_t);
247 void set_ulong64(ULong64_t);
248 void set_float(float);
249 void set_double(double);
250 void set_ldouble(long double);
251 void set_complex(complex_t);
252 void set_icomplex(icomplex_t);
253 void set_enum(EWhat);
254 void set_voidp(void*);
255
256 void set_pod_val(CppyyTestPod); // for m_pod
257 void set_pod_ptr_in(CppyyTestPod*);
258 void set_pod_ptr_out(CppyyTestPod*);
259 void set_pod_ref(const CppyyTestPod&);
260 void set_pod_ptrptr_in(CppyyTestPod**);
261 void set_pod_void_ptrptr_in(void**);
262 void set_pod_ptrptr_out(CppyyTestPod**);
263 void set_pod_void_ptrptr_out(void**);
264
265 void set_pod_ptr(CppyyTestPod*); // for m_ppod
266
267 // setters const-ref
268 void set_bool_cr(const bool&);
269 void set_char_cr(const char&);
270 void set_schar_cr(const signed char&);
271 void set_uchar_cr(const unsigned char&);
272 void set_wchar_cr(const wchar_t&);
273 void set_char16_cr(const char16_t&);
274 void set_char32_cr(const char32_t&);
275 #if __cplusplus > 201402L
276 void set_byte_cr(const std::byte&);
277 #endif
278 void set_int8_cr(const int8_t&);
279 void set_uint8_cr(const uint8_t&);
280 void set_short_cr(const short&);
281 void set_ushort_cr(const unsigned short&);
282 void set_int_cr(const int&);
283 void set_uint_cr(const unsigned int&);
284 void set_long_cr(const long&);
285 void set_ulong_cr(const unsigned long&);
286 void set_llong_cr(const long long&);
287 void set_ullong_cr(const unsigned long long&);
288 void set_long64_cr(const Long64_t&);
289 void set_ulong64_cr(const ULong64_t&);
290 void set_float_cr(const float&);
291 void set_double_cr(const double&);
292 void set_ldouble_cr(const long double&);
293 void set_complex_cr(const complex_t&);
294 void set_icomplex_cr(const icomplex_t&);
295 void set_enum_cr(const EWhat&);
296
297 // setters ref
298 void set_bool_r(bool&);
299 void set_char_r(char&);
300 void set_wchar_r(wchar_t&);
301 void set_char16_r(char16_t&);
302 void set_char32_r(char32_t&);
303 void set_schar_r(signed char&);
304 void set_uchar_r(unsigned char&);
305 #if __cplusplus > 201402L
306 void set_byte_r(std::byte&);
307 #endif
308 void set_short_r(short&);
309 void set_ushort_r(unsigned short&);
310 void set_int_r(int&);
311 void set_uint_r(unsigned int&);
312 void set_long_r(long&);
313 void set_ulong_r(unsigned long&);
314 void set_llong_r(long long&);
315 void set_ullong_r(unsigned long long&);
316 void set_float_r(float&);
317 void set_double_r(double&);
318 void set_ldouble_r(long double&);
319
320 // setters ptr
321 void set_bool_p(bool*);
322 void set_char_p(char*);
323 void set_wchar_p(wchar_t*);
324 void set_char16_p(char16_t*);
325 void set_char32_p(char32_t*);
326 void set_schar_p(signed char*);
327 void set_uchar_p(unsigned char*);
328 #if __cplusplus > 201402L
329 void set_byte_p(std::byte*);
330 #endif
331 void set_short_p(short*);
332 void set_ushort_p(unsigned short*);
333 void set_int_p(int*);
334 void set_uint_p(unsigned int*);
335 void set_long_p(long*);
336 void set_ulong_p(unsigned long*);
337 void set_llong_p(long long*);
338 void set_ullong_p(unsigned long long*);
339 void set_float_p(float*);
340 void set_double_p(double*);
341 void set_ldouble_p(long double*);
342
343 // setters ptrptr
344 void set_bool_ppa(bool**);
345 void set_char_ppa(char**);
346 void set_wchar_ppa(wchar_t**);
347 void set_char16_ppa(char16_t**);
348 void set_char32_ppa(char32_t**);
349 void set_schar_ppa(signed char**);
350 void set_uchar_ppa(unsigned char**);
351 #if __cplusplus > 201402L
352 void set_byte_ppa(std::byte**);
353 #endif
354 void set_short_ppa(short**);
355 void set_ushort_ppa(unsigned short**);
356 void set_int_ppa(int**);
357 void set_uint_ppa(unsigned int**);
358 void set_long_ppa(long**);
359 void set_ulong_ppa(unsigned long**);
360 void set_llong_ppa(long long**);
361 void set_ullong_ppa(unsigned long long**);
362 void set_float_ppa(float**);
363 void set_double_ppa(double**);
364 void set_ldouble_ppa(long double**);
365
366 intptr_t set_char_ppm(char**);
367 intptr_t set_cchar_ppm(const char**);
368 intptr_t set_wchar_ppm(wchar_t**);
369 intptr_t set_char16_ppm(char16_t**);
370 intptr_t set_char32_ppm(char32_t**);
371 intptr_t set_cwchar_ppm(const wchar_t**);
372 intptr_t set_cchar16_ppm(const char16_t**);
373 intptr_t set_cchar32_ppm(const char32_t**);
374 intptr_t set_void_ppm(void**);
375
376 intptr_t freeit(void*);
377
378 // setters r-value
379 void set_bool_rv(bool&&);
380 void set_char_rv(char&&);
381 void set_schar_rv(signed char&&);
382 void set_uchar_rv(unsigned char&&);
383 void set_wchar_rv(wchar_t&&);
384 void set_char16_rv(char16_t&&);
385 void set_char32_rv(char32_t&&);
386 #if __cplusplus > 201402L
387 void set_byte_rv(std::byte&&);
388 #endif
389 void set_int8_rv(int8_t&&);
390 void set_uint8_rv(uint8_t&&);
391 void set_short_rv(short&&);
392 void set_ushort_rv(unsigned short&&);
393 void set_int_rv(int&&);
394 void set_uint_rv(unsigned int&&);
395 void set_long_rv(long&&);
396 void set_ulong_rv(unsigned long&&);
397 void set_llong_rv(long long&&);
398 void set_ullong_rv(unsigned long long&&);
399 void set_long64_rv(Long64_t&&);
400 void set_ulong64_rv(ULong64_t&&);
401 void set_float_rv(float&&);
402 void set_double_rv(double&&);
403 void set_ldouble_rv(long double&&);
404 void set_complex_rv(complex_t&&);
405 void set_icomplex_rv(icomplex_t&&);
406 void set_enum_rv(EWhat&&);
407
408 // passers
409 unsigned char* pass_array(unsigned char*);
410 short* pass_array(short*);
411 unsigned short* pass_array(unsigned short*);
412 int* pass_array(int*);
413 unsigned int* pass_array(unsigned int*);
414 long* pass_array(long*);
415 unsigned long* pass_array(unsigned long*);
416 float* pass_array(float*);
417 double* pass_array(double*);
418 complex_t* pass_array(complex_t*);
419
420 unsigned char* pass_void_array_B(void* a) { return pass_array((unsigned char*)a); }
421 short* pass_void_array_h(void* a) { return pass_array((short*)a); }
422 unsigned short* pass_void_array_H(void* a) { return pass_array((unsigned short*)a); }
423 int* pass_void_array_i(void* a) { return pass_array((int*)a); }
424 unsigned int* pass_void_array_I(void* a) { return pass_array((unsigned int*)a); }
425 long* pass_void_array_l(void* a) { return pass_array((long*)a); }
426 unsigned long* pass_void_array_L(void* a) { return pass_array((unsigned long*)a); }
427 float* pass_void_array_f(void* a) { return pass_array((float*)a); }
428 double* pass_void_array_d(void* a) { return pass_array((double*)a); }
429 complex_t* pass_void_array_Z(void* a) { return pass_array((complex_t*)a); }
430
431 // strings
432 const char* get_valid_string(const char* in);
433 const char* get_invalid_string();
434 const wchar_t* get_valid_wstring(const wchar_t* in);
435 const wchar_t* get_invalid_wstring();
436 const char16_t* get_valid_string16(const char16_t* in);
437 const char16_t* get_invalid_string16();
438 const char32_t* get_valid_string32(const char32_t* in);
439 const char32_t* get_invalid_string32();
440
441 public:
442 // basic types
443 bool m_bool;
444 char m_char;
445 signed char m_schar;
446 unsigned char m_uchar;
447 wchar_t m_wchar;
448 char16_t m_char16;
449 char32_t m_char32;
450 #if __cplusplus > 201402L
451 std::byte m_byte;
452 #endif
453 int8_t m_int8;
454 uint8_t m_uint8;
455 short m_short;
456 unsigned short m_ushort;
457 int m_int;
458 const int m_const_int; // special case: const testing
459 unsigned int m_uint;
460 long m_long;
461 unsigned long m_ulong;
462 long long m_llong;
463 unsigned long long m_ullong;
464 Long64_t m_long64;
465 ULong64_t m_ulong64;
466 float m_float;
467 double m_double;
468 long double m_ldouble;
469 complex_t m_complex;
470 icomplex_t m_icomplex;
471 EWhat m_enum;
472 void* m_voidp;
473
474 // array types
475 bool m_bool_array[N];
476 bool* m_bool_array2;
477 signed char m_schar_array[N];
478 signed char* m_schar_array2;
479 unsigned char m_uchar_array[N];
480 unsigned char* m_uchar_array2;
481 #if __cplusplus > 201402L
482 std::byte m_byte_array[N];
483 std::byte* m_byte_array2;
484 #endif
485 short m_short_array[N];
486 short* m_short_array2;
487 unsigned short m_ushort_array[N];
488 unsigned short* m_ushort_array2;
489 int m_int_array[N];
490 int* m_int_array2;
491 unsigned int m_uint_array[N];
492 unsigned int* m_uint_array2;
493 long m_long_array[N];
494 long* m_long_array2;
495 unsigned long m_ulong_array[N];
496 unsigned long* m_ulong_array2;
497
498 float m_float_array[N];
499 float* m_float_array2;
500 double m_double_array[N];
501 double* m_double_array2;
502 complex_t m_complex_array[N];
503 complex_t* m_complex_array2;
504 icomplex_t m_icomplex_array[N];
505 icomplex_t* m_icomplex_array2;
506
507 // object types
508 CppyyTestPod m_pod;
509 CppyyTestPod* m_ppod;
510
511 public:
512 static bool s_bool;
513 static char s_char;
514 static signed char s_schar;
515 static unsigned char s_uchar;
516 static wchar_t s_wchar;
517 static char16_t s_char16;
518 static char32_t s_char32;
519 #if __cplusplus > 201402L
520 static std::byte s_byte;
521 #endif
522 static int8_t s_int8;
523 static uint8_t s_uint8;
524 static short s_short;
525 static unsigned short s_ushort;
526 static int s_int;
527 static unsigned int s_uint;
528 static long s_long;
529 static unsigned long s_ulong;
530 static long long s_llong;
531 static unsigned long long s_ullong;
532 static Long64_t s_long64;
533 static ULong64_t s_ulong64;
534 static float s_float;
535 static double s_double;
536 static long double s_ldouble;
537 static complex_t s_complex;
538 static icomplex_t s_icomplex;
539 static EWhat s_enum;
540 static void* s_voidp;
541 static std::string s_strv;
542 static std::string* s_strp;
543
544 private:
545 bool m_owns_arrays;
546 };
547
548
549 //= global functions ========================================================
550 intptr_t get_pod_address(CppyyTestData& c);
551 intptr_t get_int_address(CppyyTestData& c);
552 intptr_t get_double_address(CppyyTestData& c);
553
554
555 //= global variables/pointers ===============================================
556 extern bool g_bool;
557 extern char g_char;
558 extern signed char g_schar;
559 extern unsigned char g_uchar;
560 extern wchar_t g_wchar;
561 extern char16_t g_char16;
562 extern char32_t g_char32;
563 #if __cplusplus > 201402L
564 extern std::byte g_byte;
565 #endif
566 extern int8_t g_int8;
567 extern uint8_t g_uint8;
568 extern short g_short;
569 extern unsigned short g_ushort;
570 extern int g_int;
571 extern unsigned int g_uint;
572 extern long g_long;
573 extern unsigned long g_ulong;
574 extern long long g_llong;
575 extern unsigned long long g_ullong;
576 extern Long64_t g_long64;
577 extern ULong64_t g_ulong64;
578 extern float g_float;
579 extern double g_double;
580 extern long double g_ldouble;
581 extern complex_t g_complex;
582 extern icomplex_t g_icomplex;
583 extern EFruit g_enum;
584 extern void* g_voidp;
585
586 static const bool g_c_bool = true;
587 static const char g_c_char = 'z';
588 static const signed char g_c_schar = 'y';
589 static const unsigned char g_c_uchar = 'x';
590 static const wchar_t g_c_wchar = L'U';
591 static const char16_t g_c_char16 = u'\u6c34';
592 static const char32_t g_c_char32 = U'\U0001f34c';
593 #if __cplusplus > 201402L
594 static const std::byte g_c_byte = (std::byte)'u';
595 #endif
596 static const int8_t g_c_int8 = -12;
597 static const uint8_t g_c_uint8 = 12;
598 static const short g_c_short = -99;
599 static const unsigned short g_c_ushort = 99u;
600 static const int g_c_int = -199;
601 static const unsigned int g_c_uint = 199u;
602 static const long g_c_long = -299;
603 static const unsigned long g_c_ulong = 299ul;
604 static const long long g_c_llong = -399ll;
605 static const unsigned long long g_c_ullong = 399ull;
606 static const Long64_t g_c_long64 = -499ll;
607 static const ULong64_t g_c_ulong64 = 499ull;
608 static const float g_c_float = -599.f;
609 static const double g_c_double = -699.;
610 static const long double g_c_ldouble = -799.l;
611 static const complex_t g_c_complex = {1., 2.};
612 static const icomplex_t g_c_icomplex = {3, 4};
613 static const EFruit g_c_enum = kApple;
614 static const void* g_c_voidp = nullptr;
615
616
617 //= global accessors ========================================================
618 void set_global_int(int i);
619 int get_global_int();
620
621 extern CppyyTestPod* g_pod;
622 bool is_global_pod(CppyyTestPod* t);
623 void set_global_pod(CppyyTestPod* t);
624 CppyyTestPod* get_global_pod();
625 CppyyTestPod* get_null_pod();
626
627 extern std::string g_some_global_string;
628 std::string get_some_global_string();
629 extern std::string g_some_global_string2;
630 std::string get_some_global_string2();
631
632 extern const char16_t* g_some_global_string16;
633 extern const char32_t* g_some_global_string32;
634
635 namespace SomeStaticDataNS {
636 extern std::string s_some_static_string;
637 std::string get_some_static_string();
638 extern std::string s_some_static_string2;
639 std::string get_some_static_string2();
640 }
641
642 struct StorableData {
643 StorableData(double d) : fData(d) {}
644 double fData;
645 };
646
647 extern StorableData gData;
648
649
650 //= special case of "byte" arrays ===========================================
651 int64_t sum_uc_data(unsigned char* data, int size);
652 #if __cplusplus > 201402L
653 int64_t sum_byte_data(std::byte* data, int size);
654 #endif
655
656
657 //= function pointer passing ================================================
658 int sum_of_int1(int i1, int i2);
659 int sum_of_int2(int i1, int i2);
660 extern int (*sum_of_int_ptr)(int, int);
661 int call_sum_of_int(int i1, int i2);
662
663 double sum_of_double(double d1, double d2);
664 double call_double_double(double (*d)(double, double), double d1, double d2);
665
666 struct sum_of_int_struct {
667 int (*sum_of_int_ptr)(int, int);
668 };
669
670 //= callable passing ========================================================
671 int call_int_int(int (*)(int, int), int, int);
672 void call_void(void (*f)(int), int i);
673 int call_refi(void (*fcn)(int&));
674 int call_refl(void (*fcn)(long&));
675 int call_refd(void (*fcn)(double&));
676
677 class StoreCallable {
678 double (*fF)(double, double);
679 public:
680 StoreCallable(double (*)(double, double));
681 void set_callable(double (*)(double, double));
682 double operator()(double, double);
683 };
684
685
686 //= callable through std::function ==========================================
687 double call_double_double_sf(const std::function<double(double, double)>&, double d1, double d2);
688
689 int call_int_int_sf(const std::function<int(int, int)>&, int, int);
690 void call_void_sf(const std::function<void(int)>&, int i);
691 int call_refi_sf(const std::function<void(int&)>&);
692 int call_refl_sf(const std::function<void(long&)>&);
693 int call_refd_sf(const std::function<void(double&)>&);
694
695 class StoreCallable_sf {
696 std::function<double(double, double)> fF;
697 public:
698 StoreCallable_sf(const std::function<double(double, double)>&);
699 void set_callable(const std::function<double(double, double)>&);
700 double operator()(double, double);
701 };
702
703
704 //= array of struct variants ================================================
705 namespace ArrayOfStruct {
706
707 struct Foo {
708 int fVal;
709 };
710
711 struct Bar1 {
712 Bar1() : fArr(new Foo[2]) { fArr[0].fVal = 42; fArr[1].fVal = 13; }
713 Bar1(const Bar1&) = delete;
714 Bar1& operator=(const Bar1&) = delete;
715 ~Bar1() { delete[] fArr; }
716 Foo* fArr;
717 };
718
719 struct Bar2 {
720 Bar2(int num_foo) : fArr(std::unique_ptr<Foo[]>{new Foo[num_foo]}) {
721 for (int i = 0; i < num_foo; ++i) fArr[i].fVal = 2*i;
722 }
723 std::unique_ptr<Foo[]> fArr;
724 };
725
726 } // namespace ArrayOfStruct
727
728
729 //= array of C strings passing ==============================================
730 namespace ArrayOfCStrings {
731 std::vector<std::string> takes_array_of_cstrings(const char* args[], int len);
732 }
733
734
735 //= aggregate testing ======================================================
736 namespace AggregateTest {
737
738 struct Aggregate1 {
739 static int sInt;
740 };
741
742 struct Aggregate2 {
743 static int sInt;
744 int fInt = 42;
745 };
746
747 }
748
749 #endif // !CPPYY_TEST_DATATYPES_H