set_value.cpp
21.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
//
// set_value.cpp
// ~~~~~~~~~~~~~
//
// Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Disable autolinking for unit tests.
#if !defined(BOOST_ALL_NO_LIB)
#define BOOST_ALL_NO_LIB 1
#endif // !defined(BOOST_ALL_NO_LIB)
// Test that header file is self-contained.
#include "asio/execution/set_value.hpp"
#include <string>
#include "../unit_test.hpp"
namespace exec = asio::execution;
static int call_count = 0;
struct no_set_value
{
};
struct const_member_set_value_0
{
void set_value() const
{
++call_count;
}
};
#if !defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT)
namespace asio {
namespace traits {
template <>
struct set_value_member<const const_member_set_value_0, void()>
{
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
typedef void result_type;
};
} // namespace traits
} // namespace asio
#endif // !defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT)
struct const_member_set_value_1
{
template <typename V1>
void set_value(ASIO_MOVE_ARG(V1) v1) const
{
typename asio::decay<V1>::type tmp(ASIO_MOVE_CAST(V1)(v1));
(void)tmp;
++call_count;
}
};
#if !defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT)
namespace asio {
namespace traits {
template <typename V1>
struct set_value_member<const const_member_set_value_1, void(V1)>
{
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
typedef void result_type;
};
} // namespace traits
} // namespace asio
#endif // !defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT)
struct const_member_set_value_2
{
template <typename V1, typename V2>
void set_value(ASIO_MOVE_ARG(V1) v1, ASIO_MOVE_ARG(V2) v2) const
{
typename asio::decay<V1>::type tmp1(ASIO_MOVE_CAST(V1)(v1));
(void)tmp1;
typename asio::decay<V2>::type tmp2(ASIO_MOVE_CAST(V2)(v2));
(void)tmp2;
++call_count;
}
};
#if !defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT)
namespace asio {
namespace traits {
template <typename V1, typename V2>
struct set_value_member<const const_member_set_value_2, void(V1, V2)>
{
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
typedef void result_type;
};
} // namespace traits
} // namespace asio
#endif // !defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT)
struct free_set_value_const_receiver_0
{
friend void set_value(const free_set_value_const_receiver_0&)
{
++call_count;
}
};
#if !defined(ASIO_HAS_DEDUCED_SET_VALUE_FREE_TRAIT)
namespace asio {
namespace traits {
template <>
struct set_value_free<const free_set_value_const_receiver_0, void()>
{
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
typedef void result_type;
};
} // namespace traits
} // namespace asio
#endif // !defined(ASIO_HAS_DEDUCED_SET_VALUE_FREE_TRAIT)
struct free_set_value_const_receiver_1
{
template <typename V1>
friend void set_value(const free_set_value_const_receiver_1&,
ASIO_MOVE_ARG(V1) v1)
{
typename asio::decay<V1>::type tmp(ASIO_MOVE_CAST(V1)(v1));
(void)tmp;
++call_count;
}
};
#if !defined(ASIO_HAS_DEDUCED_SET_VALUE_FREE_TRAIT)
namespace asio {
namespace traits {
template <typename V1>
struct set_value_free<const free_set_value_const_receiver_1, void(V1)>
{
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
typedef void result_type;
};
} // namespace traits
} // namespace asio
#endif // !defined(ASIO_HAS_DEDUCED_SET_VALUE_FREE_TRAIT)
struct free_set_value_const_receiver_2
{
template <typename V1, typename V2>
friend void set_value(const free_set_value_const_receiver_2&,
ASIO_MOVE_ARG(V1) v1, ASIO_MOVE_ARG(V2) v2)
{
typename asio::decay<V1>::type tmp1(ASIO_MOVE_CAST(V1)(v1));
(void)tmp1;
typename asio::decay<V2>::type tmp2(ASIO_MOVE_CAST(V2)(v2));
(void)tmp2;
++call_count;
}
};
#if !defined(ASIO_HAS_DEDUCED_SET_VALUE_FREE_TRAIT)
namespace asio {
namespace traits {
template <typename V1, typename V2>
struct set_value_free<const free_set_value_const_receiver_2, void(V1, V2)>
{
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
typedef void result_type;
};
} // namespace traits
} // namespace asio
#endif // !defined(ASIO_HAS_DEDUCED_SET_VALUE_FREE_TRAIT)
struct non_const_member_set_value_0
{
void set_value()
{
++call_count;
}
};
#if !defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT)
namespace asio {
namespace traits {
template <>
struct set_value_member<non_const_member_set_value_0, void()>
{
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
typedef void result_type;
};
} // namespace traits
} // namespace asio
#endif // !defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT)
struct non_const_member_set_value_1
{
template <typename V1>
void set_value(ASIO_MOVE_ARG(V1) v1)
{
typename asio::decay<V1>::type tmp(ASIO_MOVE_CAST(V1)(v1));
(void)tmp;
++call_count;
}
};
#if !defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT)
namespace asio {
namespace traits {
template <typename V1>
struct set_value_member<non_const_member_set_value_1, void(V1)>
{
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
typedef void result_type;
};
} // namespace traits
} // namespace asio
#endif // !defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT)
struct non_const_member_set_value_2
{
template <typename V1, typename V2>
void set_value(ASIO_MOVE_ARG(V1) v1, ASIO_MOVE_ARG(V2) v2)
{
typename asio::decay<V1>::type tmp1(ASIO_MOVE_CAST(V1)(v1));
(void)tmp1;
typename asio::decay<V2>::type tmp2(ASIO_MOVE_CAST(V2)(v2));
(void)tmp2;
++call_count;
}
};
#if !defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT)
namespace asio {
namespace traits {
template <typename V1, typename V2>
struct set_value_member<non_const_member_set_value_2, void(V1, V2)>
{
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
typedef void result_type;
};
} // namespace traits
} // namespace asio
#endif // !defined(ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT)
struct free_set_value_non_const_receiver_0
{
friend void set_value(free_set_value_non_const_receiver_0&)
{
++call_count;
}
};
#if !defined(ASIO_HAS_DEDUCED_SET_VALUE_FREE_TRAIT)
namespace asio {
namespace traits {
template <>
struct set_value_free<free_set_value_non_const_receiver_0, void()>
{
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
typedef void result_type;
};
} // namespace traits
} // namespace asio
#endif // !defined(ASIO_HAS_DEDUCED_SET_VALUE_FREE_TRAIT)
struct free_set_value_non_const_receiver_1
{
template <typename V1>
friend void set_value(free_set_value_non_const_receiver_1&,
ASIO_MOVE_ARG(V1) v1)
{
typename asio::decay<V1>::type tmp(ASIO_MOVE_CAST(V1)(v1));
(void)tmp;
++call_count;
}
};
#if !defined(ASIO_HAS_DEDUCED_SET_VALUE_FREE_TRAIT)
namespace asio {
namespace traits {
template <typename V1>
struct set_value_free<free_set_value_non_const_receiver_1, void(V1)>
{
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
typedef void result_type;
};
} // namespace traits
} // namespace asio
#endif // !defined(ASIO_HAS_DEDUCED_SET_VALUE_FREE_TRAIT)
struct free_set_value_non_const_receiver_2
{
template <typename V1, typename V2>
friend void set_value(free_set_value_non_const_receiver_2&,
ASIO_MOVE_ARG(V1) v1, ASIO_MOVE_ARG(V2) v2)
{
typename asio::decay<V1>::type tmp1(ASIO_MOVE_CAST(V1)(v1));
(void)tmp1;
typename asio::decay<V2>::type tmp2(ASIO_MOVE_CAST(V2)(v2));
(void)tmp2;
++call_count;
}
};
#if !defined(ASIO_HAS_DEDUCED_SET_VALUE_FREE_TRAIT)
namespace asio {
namespace traits {
template <typename V1, typename V2>
struct set_value_free<free_set_value_non_const_receiver_2, void(V1, V2)>
{
ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
typedef void result_type;
};
} // namespace traits
} // namespace asio
#endif // !defined(ASIO_HAS_DEDUCED_SET_VALUE_FREE_TRAIT)
void test_can_set_value()
{
ASIO_CONSTEXPR bool b1 = exec::can_set_value<
no_set_value&>::value;
ASIO_CHECK(b1 == false);
ASIO_CONSTEXPR bool b2 = exec::can_set_value<
const no_set_value&>::value;
ASIO_CHECK(b2 == false);
ASIO_CONSTEXPR bool b3 = exec::can_set_value<
no_set_value&, int>::value;
ASIO_CHECK(b3 == false);
ASIO_CONSTEXPR bool b4 = exec::can_set_value<
const no_set_value&, int>::value;
ASIO_CHECK(b4 == false);
ASIO_CONSTEXPR bool b5 = exec::can_set_value<
no_set_value&, int, std::string>::value;
ASIO_CHECK(b5 == false);
ASIO_CONSTEXPR bool b6 = exec::can_set_value<
const no_set_value&, int, std::string>::value;
ASIO_CHECK(b6 == false);
ASIO_CONSTEXPR bool b7 = exec::can_set_value<
const_member_set_value_0&>::value;
ASIO_CHECK(b7 == true);
ASIO_CONSTEXPR bool b8 = exec::can_set_value<
const const_member_set_value_0&>::value;
ASIO_CHECK(b8 == true);
ASIO_CONSTEXPR bool b9 = exec::can_set_value<
const_member_set_value_0&, int>::value;
ASIO_CHECK(b9 == false);
ASIO_CONSTEXPR bool b10 = exec::can_set_value<
const const_member_set_value_0&, int>::value;
ASIO_CHECK(b10 == false);
ASIO_CONSTEXPR bool b11 = exec::can_set_value<
const_member_set_value_0&, int, std::string>::value;
ASIO_CHECK(b11 == false);
ASIO_CONSTEXPR bool b12 = exec::can_set_value<
const const_member_set_value_0&, int, std::string>::value;
ASIO_CHECK(b12 == false);
ASIO_CONSTEXPR bool b13 = exec::can_set_value<
const_member_set_value_1&>::value;
ASIO_CHECK(b13 == false);
ASIO_CONSTEXPR bool b14 = exec::can_set_value<
const const_member_set_value_1&>::value;
ASIO_CHECK(b14 == false);
ASIO_CONSTEXPR bool b15 = exec::can_set_value<
const_member_set_value_1&, int>::value;
ASIO_CHECK(b15 == true);
ASIO_CONSTEXPR bool b16 = exec::can_set_value<
const const_member_set_value_1&, int>::value;
ASIO_CHECK(b16 == true);
ASIO_CONSTEXPR bool b17 = exec::can_set_value<
const_member_set_value_1&, int, std::string>::value;
ASIO_CHECK(b17 == false);
ASIO_CONSTEXPR bool b18 = exec::can_set_value<
const const_member_set_value_1&, int, std::string>::value;
ASIO_CHECK(b18 == false);
ASIO_CONSTEXPR bool b19 = exec::can_set_value<
const_member_set_value_2&>::value;
ASIO_CHECK(b19 == false);
ASIO_CONSTEXPR bool b20 = exec::can_set_value<
const const_member_set_value_2&>::value;
ASIO_CHECK(b20 == false);
ASIO_CONSTEXPR bool b21 = exec::can_set_value<
const_member_set_value_2&, int>::value;
ASIO_CHECK(b21 == false);
ASIO_CONSTEXPR bool b22 = exec::can_set_value<
const const_member_set_value_2&, int>::value;
ASIO_CHECK(b22 == false);
ASIO_CONSTEXPR bool b23 = exec::can_set_value<
const_member_set_value_2&, int, std::string>::value;
ASIO_CHECK(b23 == true);
ASIO_CONSTEXPR bool b24 = exec::can_set_value<
const const_member_set_value_2&, int, std::string>::value;
ASIO_CHECK(b24 == true);
ASIO_CONSTEXPR bool b25 = exec::can_set_value<
free_set_value_const_receiver_0&>::value;
ASIO_CHECK(b25 == true);
ASIO_CONSTEXPR bool b26 = exec::can_set_value<
const free_set_value_const_receiver_0&>::value;
ASIO_CHECK(b26 == true);
ASIO_CONSTEXPR bool b27 = exec::can_set_value<
free_set_value_const_receiver_0&, int>::value;
ASIO_CHECK(b27 == false);
ASIO_CONSTEXPR bool b28 = exec::can_set_value<
const free_set_value_const_receiver_0&, int>::value;
ASIO_CHECK(b28 == false);
ASIO_CONSTEXPR bool b29 = exec::can_set_value<
free_set_value_const_receiver_0&, int, std::string>::value;
ASIO_CHECK(b29 == false);
ASIO_CONSTEXPR bool b30 = exec::can_set_value<
const free_set_value_const_receiver_0&, int, std::string>::value;
ASIO_CHECK(b30 == false);
ASIO_CONSTEXPR bool b31 = exec::can_set_value<
free_set_value_const_receiver_1&>::value;
ASIO_CHECK(b31 == false);
ASIO_CONSTEXPR bool b32 = exec::can_set_value<
const free_set_value_const_receiver_1&>::value;
ASIO_CHECK(b32 == false);
ASIO_CONSTEXPR bool b33 = exec::can_set_value<
free_set_value_const_receiver_1&, int>::value;
ASIO_CHECK(b33 == true);
ASIO_CONSTEXPR bool b34 = exec::can_set_value<
const free_set_value_const_receiver_1&, int>::value;
ASIO_CHECK(b34 == true);
ASIO_CONSTEXPR bool b35 = exec::can_set_value<
free_set_value_const_receiver_1&, int, std::string>::value;
ASIO_CHECK(b35 == false);
ASIO_CONSTEXPR bool b36 = exec::can_set_value<
const free_set_value_const_receiver_1&, int, std::string>::value;
ASIO_CHECK(b36 == false);
ASIO_CONSTEXPR bool b37 = exec::can_set_value<
free_set_value_const_receiver_2&>::value;
ASIO_CHECK(b37 == false);
ASIO_CONSTEXPR bool b38 = exec::can_set_value<
const free_set_value_const_receiver_2&>::value;
ASIO_CHECK(b38 == false);
ASIO_CONSTEXPR bool b39 = exec::can_set_value<
free_set_value_const_receiver_2&, int>::value;
ASIO_CHECK(b39 == false);
ASIO_CONSTEXPR bool b40 = exec::can_set_value<
const free_set_value_const_receiver_2&, int>::value;
ASIO_CHECK(b40 == false);
ASIO_CONSTEXPR bool b41 = exec::can_set_value<
free_set_value_const_receiver_2&, int, std::string>::value;
ASIO_CHECK(b41 == true);
ASIO_CONSTEXPR bool b42 = exec::can_set_value<
const free_set_value_const_receiver_2&, int, std::string>::value;
ASIO_CHECK(b42 == true);
ASIO_CONSTEXPR bool b43 = exec::can_set_value<
non_const_member_set_value_0&>::value;
ASIO_CHECK(b43 == true);
ASIO_CONSTEXPR bool b44 = exec::can_set_value<
const non_const_member_set_value_0&>::value;
ASIO_CHECK(b44 == false);
ASIO_CONSTEXPR bool b45 = exec::can_set_value<
non_const_member_set_value_0&, int>::value;
ASIO_CHECK(b45 == false);
ASIO_CONSTEXPR bool b46 = exec::can_set_value<
const non_const_member_set_value_0&, int>::value;
ASIO_CHECK(b46 == false);
ASIO_CONSTEXPR bool b47 = exec::can_set_value<
non_const_member_set_value_0&, int, std::string>::value;
ASIO_CHECK(b47 == false);
ASIO_CONSTEXPR bool b48 = exec::can_set_value<
const non_const_member_set_value_0&, int, std::string>::value;
ASIO_CHECK(b48 == false);
ASIO_CONSTEXPR bool b49 = exec::can_set_value<
non_const_member_set_value_1&>::value;
ASIO_CHECK(b49 == false);
ASIO_CONSTEXPR bool b50 = exec::can_set_value<
const non_const_member_set_value_1&>::value;
ASIO_CHECK(b50 == false);
ASIO_CONSTEXPR bool b51 = exec::can_set_value<
non_const_member_set_value_1&, int>::value;
ASIO_CHECK(b51 == true);
ASIO_CONSTEXPR bool b52 = exec::can_set_value<
const non_const_member_set_value_1&, int>::value;
ASIO_CHECK(b52 == false);
ASIO_CONSTEXPR bool b53 = exec::can_set_value<
non_const_member_set_value_1&, int, std::string>::value;
ASIO_CHECK(b53 == false);
ASIO_CONSTEXPR bool b54 = exec::can_set_value<
const non_const_member_set_value_1&, int, std::string>::value;
ASIO_CHECK(b54 == false);
ASIO_CONSTEXPR bool b55 = exec::can_set_value<
non_const_member_set_value_2&>::value;
ASIO_CHECK(b55 == false);
ASIO_CONSTEXPR bool b56 = exec::can_set_value<
const non_const_member_set_value_2&>::value;
ASIO_CHECK(b56 == false);
ASIO_CONSTEXPR bool b57 = exec::can_set_value<
non_const_member_set_value_2&, int>::value;
ASIO_CHECK(b57 == false);
ASIO_CONSTEXPR bool b58 = exec::can_set_value<
const non_const_member_set_value_2&, int>::value;
ASIO_CHECK(b58 == false);
ASIO_CONSTEXPR bool b59 = exec::can_set_value<
non_const_member_set_value_2&, int, std::string>::value;
ASIO_CHECK(b59 == true);
ASIO_CONSTEXPR bool b60 = exec::can_set_value<
const non_const_member_set_value_2&, int, std::string>::value;
ASIO_CHECK(b60 == false);
ASIO_CONSTEXPR bool b61 = exec::can_set_value<
free_set_value_non_const_receiver_0&>::value;
ASIO_CHECK(b61 == true);
ASIO_CONSTEXPR bool b62 = exec::can_set_value<
const free_set_value_non_const_receiver_0&>::value;
ASIO_CHECK(b62 == false);
ASIO_CONSTEXPR bool b63 = exec::can_set_value<
free_set_value_non_const_receiver_0&, int>::value;
ASIO_CHECK(b63 == false);
ASIO_CONSTEXPR bool b64 = exec::can_set_value<
const free_set_value_non_const_receiver_0&, int>::value;
ASIO_CHECK(b64 == false);
ASIO_CONSTEXPR bool b65 = exec::can_set_value<
free_set_value_non_const_receiver_0&, int, std::string>::value;
ASIO_CHECK(b65 == false);
ASIO_CONSTEXPR bool b66 = exec::can_set_value<
const free_set_value_non_const_receiver_0&, int, std::string>::value;
ASIO_CHECK(b66 == false);
ASIO_CONSTEXPR bool b67 = exec::can_set_value<
free_set_value_non_const_receiver_1&>::value;
ASIO_CHECK(b67 == false);
ASIO_CONSTEXPR bool b68 = exec::can_set_value<
const free_set_value_non_const_receiver_1&>::value;
ASIO_CHECK(b68 == false);
ASIO_CONSTEXPR bool b69 = exec::can_set_value<
free_set_value_non_const_receiver_1&, int>::value;
ASIO_CHECK(b69 == true);
ASIO_CONSTEXPR bool b70 = exec::can_set_value<
const free_set_value_non_const_receiver_1&, int>::value;
ASIO_CHECK(b70 == false);
ASIO_CONSTEXPR bool b71 = exec::can_set_value<
free_set_value_non_const_receiver_1&, int, std::string>::value;
ASIO_CHECK(b71 == false);
ASIO_CONSTEXPR bool b72 = exec::can_set_value<
const free_set_value_non_const_receiver_1&, int, std::string>::value;
ASIO_CHECK(b72 == false);
ASIO_CONSTEXPR bool b73 = exec::can_set_value<
free_set_value_non_const_receiver_2&>::value;
ASIO_CHECK(b73 == false);
ASIO_CONSTEXPR bool b74 = exec::can_set_value<
const free_set_value_non_const_receiver_2&>::value;
ASIO_CHECK(b74 == false);
ASIO_CONSTEXPR bool b75 = exec::can_set_value<
free_set_value_non_const_receiver_2&, int>::value;
ASIO_CHECK(b75 == false);
ASIO_CONSTEXPR bool b76 = exec::can_set_value<
const free_set_value_non_const_receiver_2&, int>::value;
ASIO_CHECK(b76 == false);
ASIO_CONSTEXPR bool b77 = exec::can_set_value<
free_set_value_non_const_receiver_2&, int, std::string>::value;
ASIO_CHECK(b77 == true);
ASIO_CONSTEXPR bool b78 = exec::can_set_value<
const free_set_value_non_const_receiver_2&, int, std::string>::value;
ASIO_CHECK(b78 == false);
}
void increment(int* count)
{
++(*count);
}
void test_set_value()
{
call_count = 0;
const_member_set_value_0 ex1 = {};
exec::set_value(ex1);
ASIO_CHECK(call_count == 1);
call_count = 0;
const const_member_set_value_0 ex2 = {};
exec::set_value(ex2);
ASIO_CHECK(call_count == 1);
call_count = 0;
exec::set_value(const_member_set_value_0());
ASIO_CHECK(call_count == 1);
call_count = 0;
const_member_set_value_1 ex3 = {};
exec::set_value(ex3, 123);
ASIO_CHECK(call_count == 1);
call_count = 0;
const const_member_set_value_1 ex4 = {};
exec::set_value(ex4, 123);
ASIO_CHECK(call_count == 1);
call_count = 0;
exec::set_value(const_member_set_value_1(), 123);
ASIO_CHECK(call_count == 1);
call_count = 0;
const_member_set_value_2 ex5 = {};
exec::set_value(ex5, 123, std::string());
ASIO_CHECK(call_count == 1);
call_count = 0;
const const_member_set_value_2 ex6 = {};
exec::set_value(ex6, 123, std::string());
ASIO_CHECK(call_count == 1);
call_count = 0;
exec::set_value(const_member_set_value_2(), 123, std::string());
ASIO_CHECK(call_count == 1);
call_count = 0;
free_set_value_const_receiver_0 ex7 = {};
exec::set_value(ex7);
ASIO_CHECK(call_count == 1);
call_count = 0;
const free_set_value_const_receiver_0 ex8 = {};
exec::set_value(ex8);
ASIO_CHECK(call_count == 1);
call_count = 0;
exec::set_value(free_set_value_const_receiver_0());
ASIO_CHECK(call_count == 1);
call_count = 0;
free_set_value_const_receiver_1 ex9 = {};
exec::set_value(ex9, 123);
ASIO_CHECK(call_count == 1);
call_count = 0;
const free_set_value_const_receiver_1 ex10 = {};
exec::set_value(ex10, 123);
ASIO_CHECK(call_count == 1);
call_count = 0;
exec::set_value(free_set_value_const_receiver_1(), 123);
ASIO_CHECK(call_count == 1);
call_count = 0;
free_set_value_const_receiver_2 ex11 = {};
exec::set_value(ex11, 123, std::string());
ASIO_CHECK(call_count == 1);
call_count = 0;
const free_set_value_const_receiver_2 ex12 = {};
exec::set_value(ex12, 123, std::string());
ASIO_CHECK(call_count == 1);
call_count = 0;
exec::set_value(free_set_value_const_receiver_2(), 123, std::string());
ASIO_CHECK(call_count == 1);
call_count = 0;
non_const_member_set_value_0 ex13 = {};
exec::set_value(ex13);
ASIO_CHECK(call_count == 1);
call_count = 0;
non_const_member_set_value_1 ex14 = {};
exec::set_value(ex14, 123);
ASIO_CHECK(call_count == 1);
call_count = 0;
non_const_member_set_value_2 ex15 = {};
exec::set_value(ex15, 123, std::string());
ASIO_CHECK(call_count == 1);
call_count = 0;
free_set_value_non_const_receiver_0 ex16 = {};
exec::set_value(ex16);
ASIO_CHECK(call_count == 1);
call_count = 0;
free_set_value_non_const_receiver_1 ex17 = {};
exec::set_value(ex17, 123);
ASIO_CHECK(call_count == 1);
call_count = 0;
free_set_value_non_const_receiver_2 ex18 = {};
exec::set_value(ex18, 123, std::string());
ASIO_CHECK(call_count == 1);
}
ASIO_TEST_SUITE
(
"set_value",
ASIO_TEST_CASE(test_can_set_value)
ASIO_TEST_CASE(test_set_value)
)