mimic++ v5
Loading...
Searching...
No Matches
TypeTraits.hpp
Go to the documentation of this file.
1// // Copyright Dominic (DNKpp) Koepke 2024 - 2024.
2// // Distributed under the Boost Software License, Version 1.0.
3// // (See accompanying file LICENSE_1_0.txt or copy at
4// // https://www.boost.org/LICENSE_1_0.txt)
5
6#ifndef MIMICPP_TYPE_TRAITS_HPP
7#define MIMICPP_TYPE_TRAITS_HPP
8
9#pragma once
10
11#include "Fwd.hpp"
12
13#include <concepts>
14#include <cstddef>
15#include <cstdint>
16#include <tuple>
17#include <type_traits>
18
19namespace mimicpp::detail
20{
21 template <typename Signature>
22 struct has_default_call_convention
23 : public std::false_type
24 {
25 };
26
27 template <typename Signature>
28 inline constexpr bool has_default_call_convention_v = has_default_call_convention<Signature>::value;
29
30 template <typename Return, typename... Params>
31 struct has_default_call_convention<Return(Params...)>
32 : public std::true_type
33 {
34 };
35
36 template <typename Return, typename... Params>
37 struct has_default_call_convention<Return(Params..., ...)>
38 : public std::true_type
39 {
40 };
41
42 template <typename Return, typename... Params>
43 struct has_default_call_convention<Return(Params...) noexcept>
44 : public std::true_type
45 {
46 };
47
48 template <typename Return, typename... Params>
49 struct has_default_call_convention<Return(Params..., ...) noexcept>
50 : public std::true_type
51 {
52 };
53
54 template <typename Return, typename... Params>
55 struct has_default_call_convention<Return(Params...) const>
56 : public std::true_type
57 {
58 };
59
60 template <typename Return, typename... Params>
61 struct has_default_call_convention<Return(Params..., ...) const>
62 : public std::true_type
63 {
64 };
65
66 template <typename Return, typename... Params>
67 struct has_default_call_convention<Return(Params...) const noexcept>
68 : public std::true_type
69 {
70 };
71
72 template <typename Return, typename... Params>
73 struct has_default_call_convention<Return(Params..., ...) const noexcept>
74 : public std::true_type
75 {
76 };
77
78 template <typename Return, typename... Params>
79 struct has_default_call_convention<Return(Params...)&>
80 : public std::true_type
81 {
82 };
83
84 template <typename Return, typename... Params>
85 struct has_default_call_convention<Return(Params..., ...)&>
86 : public std::true_type
87 {
88 };
89
90 template <typename Return, typename... Params>
91 struct has_default_call_convention<Return(Params...) & noexcept>
92 : public std::true_type
93 {
94 };
95
96 template <typename Return, typename... Params>
97 struct has_default_call_convention<Return(Params..., ...) & noexcept>
98 : public std::true_type
99 {
100 };
101
102 template <typename Return, typename... Params>
103 struct has_default_call_convention<Return(Params...) const&>
104 : public std::true_type
105 {
106 };
107
108 template <typename Return, typename... Params>
109 struct has_default_call_convention<Return(Params..., ...) const&>
110 : public std::true_type
111 {
112 };
113
114 template <typename Return, typename... Params>
115 struct has_default_call_convention<Return(Params...) const & noexcept>
116 : public std::true_type
117 {
118 };
119
120 template <typename Return, typename... Params>
121 struct has_default_call_convention<Return(Params..., ...) const & noexcept>
122 : public std::true_type
123 {
124 };
125
126 template <typename Return, typename... Params>
127 struct has_default_call_convention<Return(Params...) &&>
128 : public std::true_type
129 {
130 };
131
132 template <typename Return, typename... Params>
133 struct has_default_call_convention<Return(Params..., ...) &&>
134 : public std::true_type
135 {
136 };
137
138 template <typename Return, typename... Params>
139 struct has_default_call_convention<Return(Params...) && noexcept>
140 : public std::true_type
141 {
142 };
143
144 template <typename Return, typename... Params>
145 struct has_default_call_convention<Return(Params..., ...) && noexcept>
146 : public std::true_type
147 {
148 };
149
150 template <typename Return, typename... Params>
151 struct has_default_call_convention<Return(Params...) const&&>
152 : public std::true_type
153 {
154 };
155
156 template <typename Return, typename... Params>
157 struct has_default_call_convention<Return(Params..., ...) const&&>
158 : public std::true_type
159 {
160 };
161
162 template <typename Return, typename... Params>
163 struct has_default_call_convention<Return(Params...) const && noexcept>
164 : public std::true_type
165 {
166 };
167
168 template <typename Return, typename... Params>
169 struct has_default_call_convention<Return(Params..., ...) const && noexcept>
170 : public std::true_type
171 {
172 };
173
174 struct default_call_convention
175 {
176 };
177}
178
179namespace mimicpp
180{
191 template <typename Signature>
192 concept has_default_call_convention = detail::has_default_call_convention_v<Signature>;
193
207 template <has_default_call_convention Signature>
209 {
210 using type = detail::default_call_convention;
211 };
212
242 template <>
243 struct call_convention_traits<detail::default_call_convention>
244 {
245 using tag_t = detail::default_call_convention;
246
247 template <typename Signature>
248 using remove_call_convention_t = std::type_identity_t<Signature>;
249
250 template <typename Signature>
251 using add_call_convention_t = std::type_identity_t<Signature>;
252
253 template <typename Derived, typename Signature>
254 using call_interface_t = detail::DefaultCallInterface<Derived, Signature>;
255 };
256
269 template <typename Return, typename... Params>
270 struct signature_add_noexcept<Return(Params...)>
271 {
272 using type = Return(Params...) noexcept;
273 };
274
275 template <typename Return, typename... Params>
276 struct signature_add_noexcept<Return(Params..., ...)>
277 {
278 using type = Return(Params..., ...) noexcept;
279 };
280
281 template <typename Return, typename... Params>
282 struct signature_add_noexcept<Return(Params...) noexcept>
283 {
284 using type = Return(Params...) noexcept;
285 };
286
287 template <typename Return, typename... Params>
288 struct signature_add_noexcept<Return(Params..., ...) noexcept>
289 {
290 using type = Return(Params..., ...) noexcept;
291 };
292
293 template <typename Return, typename... Params>
294 struct signature_add_noexcept<Return(Params...) const>
295 {
296 using type = Return(Params...) const noexcept;
297 };
298
299 template <typename Return, typename... Params>
300 struct signature_add_noexcept<Return(Params..., ...) const>
301 {
302 using type = Return(Params..., ...) const noexcept;
303 };
304
305 template <typename Return, typename... Params>
306 struct signature_add_noexcept<Return(Params...) const noexcept>
307 {
308 using type = Return(Params...) const noexcept;
309 };
310
311 template <typename Return, typename... Params>
312 struct signature_add_noexcept<Return(Params..., ...) const noexcept>
313 {
314 using type = Return(Params..., ...) const noexcept;
315 };
316
317 template <typename Return, typename... Params>
318 struct signature_add_noexcept<Return(Params...)&>
319 {
320 using type = Return(Params...) & noexcept;
321 };
322
323 template <typename Return, typename... Params>
324 struct signature_add_noexcept<Return(Params..., ...)&>
325 {
326 using type = Return(Params..., ...) & noexcept;
327 };
328
329 template <typename Return, typename... Params>
330 struct signature_add_noexcept<Return(Params...) & noexcept>
331 {
332 using type = Return(Params...) & noexcept;
333 };
334
335 template <typename Return, typename... Params>
336 struct signature_add_noexcept<Return(Params..., ...) & noexcept>
337 {
338 using type = Return(Params..., ...) & noexcept;
339 };
340
341 template <typename Return, typename... Params>
342 struct signature_add_noexcept<Return(Params...) const&>
343 {
344 using type = Return(Params...) const& noexcept;
345 };
346
347 template <typename Return, typename... Params>
348 struct signature_add_noexcept<Return(Params..., ...) const&>
349 {
350 using type = Return(Params..., ...) const& noexcept;
351 };
352
353 template <typename Return, typename... Params>
354 struct signature_add_noexcept<Return(Params...) const & noexcept>
355 {
356 using type = Return(Params...) const& noexcept;
357 };
358
359 template <typename Return, typename... Params>
360 struct signature_add_noexcept<Return(Params..., ...) const & noexcept>
361 {
362 using type = Return(Params..., ...) const& noexcept;
363 };
364
365 template <typename Return, typename... Params>
366 struct signature_add_noexcept<Return(Params...) &&>
367 {
368 using type = Return(Params...) && noexcept;
369 };
370
371 template <typename Return, typename... Params>
372 struct signature_add_noexcept<Return(Params..., ...) &&>
373 {
374 using type = Return(Params..., ...) && noexcept;
375 };
376
377 template <typename Return, typename... Params>
378 struct signature_add_noexcept<Return(Params...) && noexcept>
379 {
380 using type = Return(Params...) && noexcept;
381 };
382
383 template <typename Return, typename... Params>
384 struct signature_add_noexcept<Return(Params..., ...) && noexcept>
385 {
386 using type = Return(Params..., ...) && noexcept;
387 };
388
389 template <typename Return, typename... Params>
390 struct signature_add_noexcept<Return(Params...) const&&>
391 {
392 using type = Return(Params...) const&& noexcept;
393 };
394
395 template <typename Return, typename... Params>
396 struct signature_add_noexcept<Return(Params..., ...) const&&>
397 {
398 using type = Return(Params..., ...) const&& noexcept;
399 };
400
401 template <typename Return, typename... Params>
402 struct signature_add_noexcept<Return(Params...) const && noexcept>
403 {
404 using type = Return(Params...) const&& noexcept;
405 };
406
407 template <typename Return, typename... Params>
408 struct signature_add_noexcept<Return(Params..., ...) const && noexcept>
409 {
410 using type = Return(Params..., ...) const&& noexcept;
411 };
412
425 template <typename Signature>
427 {
428 using type = typename call_convention_traits<
429 signature_call_convention_t<Signature>>::template remove_call_convention_t<Signature>;
430 };
431
444 template <typename Signature>
447 {
449 using type =
450 typename call_convention_traits_t::template add_call_convention_t<
452 typename call_convention_traits_t::template remove_call_convention_t<Signature>>>;
453 };
454
455 template <typename Return, typename... Params>
456 struct signature_remove_noexcept<Return(Params...)>
457 {
458 using type = Return(Params...);
459 };
460
461 template <typename Return, typename... Params>
462 struct signature_remove_noexcept<Return(Params..., ...)>
463 {
464 using type = Return(Params..., ...);
465 };
466
467 template <typename Return, typename... Params>
468 struct signature_remove_noexcept<Return(Params...) noexcept>
469 {
470 using type = Return(Params...);
471 };
472
473 template <typename Return, typename... Params>
474 struct signature_remove_noexcept<Return(Params..., ...) noexcept>
475 {
476 using type = Return(Params..., ...);
477 };
478
479 template <typename Return, typename... Params>
480 struct signature_remove_noexcept<Return(Params...) const>
481 {
482 using type = Return(Params...) const;
483 };
484
485 template <typename Return, typename... Params>
486 struct signature_remove_noexcept<Return(Params..., ...) const>
487 {
488 using type = Return(Params..., ...) const;
489 };
490
491 template <typename Return, typename... Params>
492 struct signature_remove_noexcept<Return(Params...) const noexcept>
493 {
494 using type = Return(Params...) const;
495 };
496
497 template <typename Return, typename... Params>
498 struct signature_remove_noexcept<Return(Params..., ...) const noexcept>
499 {
500 using type = Return(Params..., ...) const;
501 };
502
503 template <typename Return, typename... Params>
504 struct signature_remove_noexcept<Return(Params...)&>
505 {
506 using type = Return(Params...) &;
507 };
508
509 template <typename Return, typename... Params>
510 struct signature_remove_noexcept<Return(Params..., ...)&>
511 {
512 using type = Return(Params..., ...) &;
513 };
514
515 template <typename Return, typename... Params>
516 struct signature_remove_noexcept<Return(Params...) & noexcept>
517 {
518 using type = Return(Params...) &;
519 };
520
521 template <typename Return, typename... Params>
522 struct signature_remove_noexcept<Return(Params..., ...) & noexcept>
523 {
524 using type = Return(Params..., ...) &;
525 };
526
527 template <typename Return, typename... Params>
528 struct signature_remove_noexcept<Return(Params...) const&>
529 {
530 using type = Return(Params...) const&;
531 };
532
533 template <typename Return, typename... Params>
534 struct signature_remove_noexcept<Return(Params..., ...) const&>
535 {
536 using type = Return(Params..., ...) const&;
537 };
538
539 template <typename Return, typename... Params>
540 struct signature_remove_noexcept<Return(Params...) const & noexcept>
541 {
542 using type = Return(Params...) const&;
543 };
544
545 template <typename Return, typename... Params>
546 struct signature_remove_noexcept<Return(Params..., ...) const & noexcept>
547 {
548 using type = Return(Params..., ...) const&;
549 };
550
551 template <typename Return, typename... Params>
552 struct signature_remove_noexcept<Return(Params...) &&>
553 {
554 using type = Return(Params...) &&;
555 };
556
557 template <typename Return, typename... Params>
558 struct signature_remove_noexcept<Return(Params..., ...) &&>
559 {
560 using type = Return(Params..., ...) &&;
561 };
562
563 template <typename Return, typename... Params>
564 struct signature_remove_noexcept<Return(Params...) && noexcept>
565 {
566 using type = Return(Params...) &&;
567 };
568
569 template <typename Return, typename... Params>
570 struct signature_remove_noexcept<Return(Params..., ...) && noexcept>
571 {
572 using type = Return(Params..., ...) &&;
573 };
574
575 template <typename Return, typename... Params>
576 struct signature_remove_noexcept<Return(Params...) const&&>
577 {
578 using type = Return(Params...) const&&;
579 };
580
581 template <typename Return, typename... Params>
582 struct signature_remove_noexcept<Return(Params..., ...) const&&>
583 {
584 using type = Return(Params..., ...) const&&;
585 };
586
587 template <typename Return, typename... Params>
588 struct signature_remove_noexcept<Return(Params...) const && noexcept>
589 {
590 using type = Return(Params...) const&&;
591 };
592
593 template <typename Return, typename... Params>
594 struct signature_remove_noexcept<Return(Params..., ...) const && noexcept>
595 {
596 using type = Return(Params..., ...) const&&;
597 };
598
611 template <typename Signature>
612 requires(!has_default_call_convention<Signature>)
614 {
616 using type =
617 typename call_convention_traits_t::template add_call_convention_t<
619 typename call_convention_traits_t::template remove_call_convention_t<Signature>>>;
620 };
621
622 template <typename Return, typename... Params>
623 struct signature_remove_ref_qualifier<Return(Params...)>
624 {
625 using type = Return(Params...);
626 };
627
628 template <typename Return, typename... Params>
629 struct signature_remove_ref_qualifier<Return(Params..., ...)>
630 {
631 using type = Return(Params..., ...);
632 };
633
634 template <typename Return, typename... Params>
635 struct signature_remove_ref_qualifier<Return(Params...) noexcept>
636 {
637 using type = Return(Params...) noexcept;
638 };
639
640 template <typename Return, typename... Params>
641 struct signature_remove_ref_qualifier<Return(Params..., ...) noexcept>
642 {
643 using type = Return(Params..., ...) noexcept;
644 };
645
646 template <typename Return, typename... Params>
647 struct signature_remove_ref_qualifier<Return(Params...) const>
648 {
649 using type = Return(Params...) const;
650 };
651
652 template <typename Return, typename... Params>
653 struct signature_remove_ref_qualifier<Return(Params..., ...) const>
654 {
655 using type = Return(Params..., ...) const;
656 };
657
658 template <typename Return, typename... Params>
659 struct signature_remove_ref_qualifier<Return(Params...) const noexcept>
660 {
661 using type = Return(Params...) const noexcept;
662 };
663
664 template <typename Return, typename... Params>
665 struct signature_remove_ref_qualifier<Return(Params..., ...) const noexcept>
666 {
667 using type = Return(Params..., ...) const noexcept;
668 };
669
670 template <typename Return, typename... Params>
671 struct signature_remove_ref_qualifier<Return(Params...)&>
672 {
673 using type = Return(Params...);
674 };
675
676 template <typename Return, typename... Params>
677 struct signature_remove_ref_qualifier<Return(Params..., ...)&>
678 {
679 using type = Return(Params..., ...);
680 };
681
682 template <typename Return, typename... Params>
683 struct signature_remove_ref_qualifier<Return(Params...) & noexcept>
684 {
685 using type = Return(Params...) noexcept;
686 };
687
688 template <typename Return, typename... Params>
689 struct signature_remove_ref_qualifier<Return(Params..., ...) & noexcept>
690 {
691 using type = Return(Params..., ...) noexcept;
692 };
693
694 template <typename Return, typename... Params>
695 struct signature_remove_ref_qualifier<Return(Params...) const&>
696 {
697 using type = Return(Params...) const;
698 };
699
700 template <typename Return, typename... Params>
701 struct signature_remove_ref_qualifier<Return(Params..., ...) const&>
702 {
703 using type = Return(Params..., ...) const;
704 };
705
706 template <typename Return, typename... Params>
707 struct signature_remove_ref_qualifier<Return(Params...) const & noexcept>
708 {
709 using type = Return(Params...) const noexcept;
710 };
711
712 template <typename Return, typename... Params>
713 struct signature_remove_ref_qualifier<Return(Params..., ...) const & noexcept>
714 {
715 using type = Return(Params..., ...) const noexcept;
716 };
717
718 template <typename Return, typename... Params>
719 struct signature_remove_ref_qualifier<Return(Params...) &&>
720 {
721 using type = Return(Params...);
722 };
723
724 template <typename Return, typename... Params>
725 struct signature_remove_ref_qualifier<Return(Params..., ...) &&>
726 {
727 using type = Return(Params..., ...);
728 };
729
730 template <typename Return, typename... Params>
731 struct signature_remove_ref_qualifier<Return(Params...) && noexcept>
732 {
733 using type = Return(Params...) noexcept;
734 };
735
736 template <typename Return, typename... Params>
737 struct signature_remove_ref_qualifier<Return(Params..., ...) && noexcept>
738 {
739 using type = Return(Params..., ...) noexcept;
740 };
741
742 template <typename Return, typename... Params>
743 struct signature_remove_ref_qualifier<Return(Params...) const&&>
744 {
745 using type = Return(Params...) const;
746 };
747
748 template <typename Return, typename... Params>
749 struct signature_remove_ref_qualifier<Return(Params..., ...) const&&>
750 {
751 using type = Return(Params..., ...) const;
752 };
753
754 template <typename Return, typename... Params>
755 struct signature_remove_ref_qualifier<Return(Params...) const && noexcept>
756 {
757 using type = Return(Params...) const noexcept;
758 };
759
760 template <typename Return, typename... Params>
761 struct signature_remove_ref_qualifier<Return(Params..., ...) const && noexcept>
762 {
763 using type = Return(Params..., ...) const noexcept;
764 };
765
778 template <typename Signature>
779 requires(!has_default_call_convention<Signature>)
781 {
783 using type =
784 typename call_convention_traits_t::template add_call_convention_t<
786 typename call_convention_traits_t::template remove_call_convention_t<Signature>>>;
787 };
788
789 template <typename Return, typename... Params>
790 struct signature_remove_const_qualifier<Return(Params...)>
791 {
792 using type = Return(Params...);
793 };
794
795 template <typename Return, typename... Params>
796 struct signature_remove_const_qualifier<Return(Params..., ...)>
797 {
798 using type = Return(Params..., ...);
799 };
800
801 template <typename Return, typename... Params>
802 struct signature_remove_const_qualifier<Return(Params...) noexcept>
803 {
804 using type = Return(Params...) noexcept;
805 };
806
807 template <typename Return, typename... Params>
808 struct signature_remove_const_qualifier<Return(Params..., ...) noexcept>
809 {
810 using type = Return(Params..., ...) noexcept;
811 };
812
813 template <typename Return, typename... Params>
814 struct signature_remove_const_qualifier<Return(Params...) const>
815 {
816 using type = Return(Params...);
817 };
818
819 template <typename Return, typename... Params>
820 struct signature_remove_const_qualifier<Return(Params..., ...) const>
821 {
822 using type = Return(Params..., ...);
823 };
824
825 template <typename Return, typename... Params>
826 struct signature_remove_const_qualifier<Return(Params...) const noexcept>
827 {
828 using type = Return(Params...) noexcept;
829 };
830
831 template <typename Return, typename... Params>
832 struct signature_remove_const_qualifier<Return(Params..., ...) const noexcept>
833 {
834 using type = Return(Params..., ...) noexcept;
835 };
836
837 template <typename Return, typename... Params>
838 struct signature_remove_const_qualifier<Return(Params...)&>
839 {
840 using type = Return(Params...) &;
841 };
842
843 template <typename Return, typename... Params>
844 struct signature_remove_const_qualifier<Return(Params..., ...)&>
845 {
846 using type = Return(Params..., ...) &;
847 };
848
849 template <typename Return, typename... Params>
850 struct signature_remove_const_qualifier<Return(Params...) & noexcept>
851 {
852 using type = Return(Params...) & noexcept;
853 };
854
855 template <typename Return, typename... Params>
856 struct signature_remove_const_qualifier<Return(Params..., ...) & noexcept>
857 {
858 using type = Return(Params..., ...) & noexcept;
859 };
860
861 template <typename Return, typename... Params>
862 struct signature_remove_const_qualifier<Return(Params...) const&>
863 {
864 using type = Return(Params...) &;
865 };
866
867 template <typename Return, typename... Params>
868 struct signature_remove_const_qualifier<Return(Params..., ...) const&>
869 {
870 using type = Return(Params..., ...) &;
871 };
872
873 template <typename Return, typename... Params>
874 struct signature_remove_const_qualifier<Return(Params...) const & noexcept>
875 {
876 using type = Return(Params...) & noexcept;
877 };
878
879 template <typename Return, typename... Params>
880 struct signature_remove_const_qualifier<Return(Params..., ...) const & noexcept>
881 {
882 using type = Return(Params..., ...) & noexcept;
883 };
884
885 template <typename Return, typename... Params>
886 struct signature_remove_const_qualifier<Return(Params...) &&>
887 {
888 using type = Return(Params...) &&;
889 };
890
891 template <typename Return, typename... Params>
892 struct signature_remove_const_qualifier<Return(Params..., ...) &&>
893 {
894 using type = Return(Params..., ...) &&;
895 };
896
897 template <typename Return, typename... Params>
898 struct signature_remove_const_qualifier<Return(Params...) && noexcept>
899 {
900 using type = Return(Params...) && noexcept;
901 };
902
903 template <typename Return, typename... Params>
904 struct signature_remove_const_qualifier<Return(Params..., ...) && noexcept>
905 {
906 using type = Return(Params..., ...) && noexcept;
907 };
908
909 template <typename Return, typename... Params>
910 struct signature_remove_const_qualifier<Return(Params...) const&&>
911 {
912 using type = Return(Params...) &&;
913 };
914
915 template <typename Return, typename... Params>
916 struct signature_remove_const_qualifier<Return(Params..., ...) const&&>
917 {
918 using type = Return(Params..., ...) &&;
919 };
920
921 template <typename Return, typename... Params>
922 struct signature_remove_const_qualifier<Return(Params...) const && noexcept>
923 {
924 using type = Return(Params...) && noexcept;
925 };
926
927 template <typename Return, typename... Params>
928 struct signature_remove_const_qualifier<Return(Params..., ...) const && noexcept>
929 {
930 using type = Return(Params..., ...) && noexcept;
931 };
932
945 template <typename Signature>
954
967 template <typename Signature>
970 : public signature_return_type<signature_decay_t<Signature>>
972 {
973 };
974
975 template <typename Return, typename... Params>
976 struct signature_return_type<Return(Params...)>
977 {
978 using type = Return;
979 };
980
981 template <typename Return, typename... Params>
982 struct signature_return_type<Return(Params..., ...)>
983 {
984 using type = Return;
985 };
986
999 template <std::size_t index, typename Signature>
1002 : public signature_param_type<
1003 index,
1004 signature_decay_t<Signature>>
1006 {
1007 };
1008
1009 template <std::size_t index, typename Return, typename... Params>
1010 struct signature_param_type<index, Return(Params...)>
1011 : public std::tuple_element<index, std::tuple<Params...>>
1012 {
1013 };
1014
1027 template <typename Signature>
1029 : public std::integral_constant<
1030 Constness,
1031 std::same_as<Signature, signature_remove_const_qualifier_t<Signature>>
1032 ? Constness::non_const
1033 : Constness::as_const>
1034 {
1035 };
1036
1049 template <typename Signature>
1053 signature_remove_noexcept_t<
1054 signature_remove_const_qualifier_t<
1055 signature_remove_call_convention_t<Signature>>>>
1057 {
1058 };
1059
1060 template <typename Return, typename... Params>
1061 struct signature_ref_qualification<Return(Params...)>
1062 : public std::integral_constant<
1063 ValueCategory,
1064 ValueCategory::any>
1065 {
1066 };
1067
1068 template <typename Return, typename... Params>
1069 struct signature_ref_qualification<Return(Params..., ...)>
1070 : public std::integral_constant<
1071 ValueCategory,
1072 ValueCategory::any>
1073 {
1074 };
1075
1076 template <typename Return, typename... Params>
1077 struct signature_ref_qualification<Return(Params...)&>
1078 : public std::integral_constant<
1080 ValueCategory::lvalue>
1081 {
1082 };
1083
1084 template <typename Return, typename... Params>
1085 struct signature_ref_qualification<Return(Params..., ...)&>
1086 : public std::integral_constant<
1088 ValueCategory::lvalue>
1089 {
1090 };
1091
1092 template <typename Return, typename... Params>
1093 struct signature_ref_qualification<Return(Params...) &&>
1094 : public std::integral_constant<
1096 ValueCategory::rvalue>
1097 {
1098 };
1099
1100 template <typename Return, typename... Params>
1101 struct signature_ref_qualification<Return(Params..., ...) &&>
1102 : public std::integral_constant<
1104 ValueCategory::rvalue>
1105 {
1106 };
1107
1120 template <typename Signature>
1122 : public std::bool_constant<
1123 !std::same_as<Signature, signature_remove_noexcept_t<Signature>>>
1124 {
1125 };
1126
1139 template <typename Signature>
1142 : public signature_param_list<
1143 signature_decay_t<Signature>>
1145 {
1146 };
1147
1148 template <typename Return, typename... Params>
1149 struct signature_param_list<Return(Params...)>
1150 {
1151 using type = type_list<Params...>;
1152 };
1153
1158 namespace detail
1159 {
1160 template <typename First, typename Second, bool reversed = false>
1162 : public std::conditional_t<
1163 reversed,
1164 std::false_type,
1165 is_overloadable_with<Second, First, true>>
1166 {
1167 };
1168
1169 template <typename First, typename Second>
1170 requires(
1171 !std::same_as<
1172 signature_param_list_t<signature_decay_t<First>>,
1173 signature_param_list_t<signature_decay_t<Second>>>)
1174 struct is_overloadable_with<First, Second, false>
1175 : public std::true_type
1176 {
1177 };
1178
1179 template <typename Return1, typename Return2, typename... Params, bool reversed>
1180 struct is_overloadable_with<Return1(Params...), Return2(Params...) const, reversed>
1181 : public std::true_type
1182 {
1183 };
1184
1185 template <typename Return1, typename Return2, typename... Params, bool reversed>
1186 struct is_overloadable_with<Return1(Params...)&, Return2(Params...) const&, reversed>
1187 : public std::true_type
1188 {
1189 };
1190
1191 template <typename Return1, typename Return2, typename... Params, bool reversed>
1192 struct is_overloadable_with<Return1(Params...)&, Return2(Params...)&&, reversed>
1193 : public std::true_type
1194 {
1195 };
1196
1197 template <typename Return1, typename Return2, typename... Params, bool reversed>
1198 struct is_overloadable_with<Return1(Params...)&, Return2(Params...) const&&, reversed>
1199 : public std::true_type
1200 {
1201 };
1202
1203 template <typename Return1, typename Return2, typename... Params, bool reversed>
1204 struct is_overloadable_with<Return1(Params...) const&, Return2(Params...)&&, reversed>
1205 : public std::true_type
1206 {
1207 };
1208
1209 template <typename Return1, typename Return2, typename... Params, bool reversed>
1210 struct is_overloadable_with<Return1(Params...) const&, Return2(Params...) const&&, reversed>
1211 : public std::true_type
1212 {
1213 };
1214
1215 template <typename Return1, typename Return2, typename... Params, bool reversed>
1216 struct is_overloadable_with<Return1(Params...)&&, Return2(Params...) const&&, reversed>
1217 : public std::true_type
1218 {
1219 };
1220
1221 template <typename Signature>
1222 using normalize_overload_t = signature_remove_noexcept_t<
1223 signature_remove_call_convention_t<Signature>>;
1224 }
1225
1234 template <typename First, typename Second>
1236 : public detail::is_overloadable_with<
1237 detail::normalize_overload_t<First>,
1238 detail::normalize_overload_t<Second>>
1239 {
1240 };
1241
1254 template <typename First, typename... Others>
1256 : public std::conjunction<
1257 is_overloadable_with<First, Others>...,
1258 is_overload_set<Others...>>
1259 {
1260 };
1261
1262 template <typename First>
1263 struct is_overload_set<First>
1264 : public std::true_type
1265 {
1266 };
1267
1284 template <>
1286 {
1287 using type = std::uint8_t;
1288 };
1289
1293 template <>
1295 {
1296 using type = std::uint16_t;
1297 };
1298
1302 template <>
1304 {
1305 using type = std::uint32_t;
1306 };
1307
1311 template <>
1313 {
1314 using type = std::uint64_t;
1315 };
1316
1320}
1321
1322#endif
Determines, whether the given signature has default call-convention.
Definition TypeTraits.hpp:192
typename signature_call_convention< Signature >::type signature_call_convention_t
Convenience alias, exposing the type member alias of the actual type-trait.
Definition Fwd.hpp:75
typename signature_remove_call_convention< Signature >::type signature_remove_call_convention_t
Convenience alias, exposing the type member alias of the actual type-trait.
Definition Fwd.hpp:91
typename signature_remove_const_qualifier< Signature >::type signature_remove_const_qualifier_t
Convenience alias, exposing the type member alias of the actual type-trait.
Definition Fwd.hpp:139
typename signature_remove_noexcept< Signature >::type signature_remove_noexcept_t
Convenience alias, exposing the type member alias of the actual type-trait.
Definition Fwd.hpp:107
typename signature_remove_ref_qualifier< Signature >::type signature_remove_ref_qualifier_t
Convenience alias, exposing the type member alias of the actual type-trait.
Definition Fwd.hpp:123
Definition BoostTest.hpp:20
ValueCategory
Definition Fwd.hpp:30
detail::DefaultCallInterface< Derived, Signature > call_interface_t
Definition TypeTraits.hpp:254
std::type_identity_t< Signature > add_call_convention_t
Definition TypeTraits.hpp:251
detail::default_call_convention tag_t
Definition TypeTraits.hpp:245
std::type_identity_t< Signature > remove_call_convention_t
Definition TypeTraits.hpp:248
Primary template, purposely undefined.
Definition Fwd.hpp:295
Primary template.
Definition TypeTraits.hpp:1259
Primary template.
Definition TypeTraits.hpp:1239
Return(Params...,...) &&noexcept type
Definition TypeTraits.hpp:374
Return(Params...,...) &&noexcept type
Definition TypeTraits.hpp:386
Return(Params...,...) &noexcept type
Definition TypeTraits.hpp:338
Return(Params...,...) const noexcept type
Definition TypeTraits.hpp:302
Return(Params...,...) const &noexcept type
Definition TypeTraits.hpp:350
Return(Params...,...) const &&noexcept type
Definition TypeTraits.hpp:398
Return(Params...,...) const &&noexcept type
Definition TypeTraits.hpp:410
Return(Params...,...) const &noexcept type
Definition TypeTraits.hpp:362
Return(Params...,...) const noexcept type
Definition TypeTraits.hpp:314
Return(Params...,...) noexcept type
Definition TypeTraits.hpp:290
Return(Params...,...) noexcept type
Definition TypeTraits.hpp:278
Return(Params...,...) &noexcept type
Definition TypeTraits.hpp:326
Return(Params...) &&noexcept type
Definition TypeTraits.hpp:368
Return(Params...) &&noexcept type
Definition TypeTraits.hpp:380
Return(Params...) &noexcept type
Definition TypeTraits.hpp:332
Return(Params...) const noexcept type
Definition TypeTraits.hpp:296
Return(Params...) const &noexcept type
Definition TypeTraits.hpp:344
Return(Params...) const &&noexcept type
Definition TypeTraits.hpp:392
Return(Params...) const &&noexcept type
Definition TypeTraits.hpp:404
Return(Params...) const &noexcept type
Definition TypeTraits.hpp:356
Return(Params...) const noexcept type
Definition TypeTraits.hpp:308
Return(Params...) noexcept type
Definition TypeTraits.hpp:284
Return(Params...) noexcept type
Definition TypeTraits.hpp:272
Return(Params...) &noexcept type
Definition TypeTraits.hpp:320
Primary template, purposely undefined.
Definition Fwd.hpp:51
detail::default_call_convention type
Definition TypeTraits.hpp:210
Primary template, purposely undefined.
Definition Fwd.hpp:67
Primary template.
Definition TypeTraits.hpp:1034
Primary template.
Definition TypeTraits.hpp:947
signature_remove_noexcept_t< signature_remove_ref_qualifier_t< signature_remove_const_qualifier_t< signature_remove_call_convention_t< Signature > > > > type
Definition TypeTraits.hpp:948
Primary template.
Definition TypeTraits.hpp:1124
Primary template.
Definition TypeTraits.hpp:1145
Primary template.
Definition TypeTraits.hpp:1006
Primary template.
Definition TypeTraits.hpp:1057
Primary template, purposely undefined.
Definition TypeTraits.hpp:427
typename call_convention_traits< signature_call_convention_t< Signature > >::template remove_call_convention_t< Signature > type
Definition TypeTraits.hpp:428
Return(Params...,...) && type
Definition TypeTraits.hpp:894
Return(Params...,...) &&noexcept type
Definition TypeTraits.hpp:906
Return(Params...,...) &noexcept type
Definition TypeTraits.hpp:858
Return(Params...,...) type
Definition TypeTraits.hpp:822
Return(Params...,...) & type
Definition TypeTraits.hpp:870
Return(Params...,...) && type
Definition TypeTraits.hpp:918
Return(Params...,...) &&noexcept type
Definition TypeTraits.hpp:930
Return(Params...,...) &noexcept type
Definition TypeTraits.hpp:882
Return(Params...,...) noexcept type
Definition TypeTraits.hpp:834
Return(Params...,...) noexcept type
Definition TypeTraits.hpp:810
Return(Params...,...) type
Definition TypeTraits.hpp:798
Return(Params...,...) & type
Definition TypeTraits.hpp:846
Return(Params...) && type
Definition TypeTraits.hpp:888
Return(Params...) &&noexcept type
Definition TypeTraits.hpp:900
Return(Params...) &noexcept type
Definition TypeTraits.hpp:852
Return(Params...) type
Definition TypeTraits.hpp:816
Return(Params...) & type
Definition TypeTraits.hpp:864
Return(Params...) && type
Definition TypeTraits.hpp:912
Return(Params...) &&noexcept type
Definition TypeTraits.hpp:924
Return(Params...) &noexcept type
Definition TypeTraits.hpp:876
Return(Params...) noexcept type
Definition TypeTraits.hpp:828
Return(Params...) noexcept type
Definition TypeTraits.hpp:804
Return(Params...) type
Definition TypeTraits.hpp:792
Return(Params...) & type
Definition TypeTraits.hpp:840
typename call_convention_traits_t::template add_call_convention_t< signature_remove_const_qualifier_t< typename call_convention_traits_t::template remove_call_convention_t< Signature > > > type
Definition TypeTraits.hpp:783
Primary template, purposely undefined.
Definition Fwd.hpp:131
Return(Params...,...) && type
Definition TypeTraits.hpp:560
Return(Params...,...) && type
Definition TypeTraits.hpp:572
Return(Params...,...) & type
Definition TypeTraits.hpp:524
Return(Params...,...) const type
Definition TypeTraits.hpp:488
Return(Params...,...) const & type
Definition TypeTraits.hpp:536
Return(Params...,...) const && type
Definition TypeTraits.hpp:584
Return(Params...,...) const && type
Definition TypeTraits.hpp:596
Return(Params...,...) const & type
Definition TypeTraits.hpp:548
Return(Params...,...) const type
Definition TypeTraits.hpp:500
Return(Params...,...) type
Definition TypeTraits.hpp:476
Return(Params...,...) type
Definition TypeTraits.hpp:464
Return(Params...,...) & type
Definition TypeTraits.hpp:512
Return(Params...) && type
Definition TypeTraits.hpp:554
Return(Params...) && type
Definition TypeTraits.hpp:566
Return(Params...) & type
Definition TypeTraits.hpp:518
Return(Params...) const type
Definition TypeTraits.hpp:482
Return(Params...) const & type
Definition TypeTraits.hpp:530
Return(Params...) const && type
Definition TypeTraits.hpp:578
Return(Params...) const && type
Definition TypeTraits.hpp:590
Return(Params...) const & type
Definition TypeTraits.hpp:542
Return(Params...) const type
Definition TypeTraits.hpp:494
Return(Params...) type
Definition TypeTraits.hpp:470
Return(Params...) type
Definition TypeTraits.hpp:458
Return(Params...) & type
Definition TypeTraits.hpp:506
typename call_convention_traits_t::template add_call_convention_t< signature_remove_noexcept_t< typename call_convention_traits_t::template remove_call_convention_t< Signature > > > type
Definition TypeTraits.hpp:449
Primary template, purposely undefined.
Definition Fwd.hpp:99
Return(Params...,...) type
Definition TypeTraits.hpp:727
Return(Params...,...) noexcept type
Definition TypeTraits.hpp:739
Return(Params...,...) noexcept type
Definition TypeTraits.hpp:691
Return(Params...,...) const type
Definition TypeTraits.hpp:655
Return(Params...,...) const type
Definition TypeTraits.hpp:703
Return(Params...,...) const type
Definition TypeTraits.hpp:751
Return(Params...,...) const noexcept type
Definition TypeTraits.hpp:763
Return(Params...,...) const noexcept type
Definition TypeTraits.hpp:715
Return(Params...,...) const noexcept type
Definition TypeTraits.hpp:667
Return(Params...,...) noexcept type
Definition TypeTraits.hpp:643
Return(Params...,...) type
Definition TypeTraits.hpp:631
Return(Params...,...) type
Definition TypeTraits.hpp:679
Return(Params...) type
Definition TypeTraits.hpp:721
Return(Params...) noexcept type
Definition TypeTraits.hpp:733
Return(Params...) noexcept type
Definition TypeTraits.hpp:685
Return(Params...) const type
Definition TypeTraits.hpp:649
Return(Params...) const type
Definition TypeTraits.hpp:697
Return(Params...) const type
Definition TypeTraits.hpp:745
Return(Params...) const noexcept type
Definition TypeTraits.hpp:757
Return(Params...) const noexcept type
Definition TypeTraits.hpp:709
Return(Params...) const noexcept type
Definition TypeTraits.hpp:661
Return(Params...) noexcept type
Definition TypeTraits.hpp:637
Return(Params...) type
Definition TypeTraits.hpp:625
Return(Params...) type
Definition TypeTraits.hpp:673
typename call_convention_traits_t::template add_call_convention_t< signature_remove_ref_qualifier_t< typename call_convention_traits_t::template remove_call_convention_t< Signature > > > type
Definition TypeTraits.hpp:616
Primary template, purposely undefined.
Definition Fwd.hpp:115
Return type
Definition TypeTraits.hpp:984
Return type
Definition TypeTraits.hpp:978
Primary template.
Definition TypeTraits.hpp:972
A very basic type-list template.
Definition Fwd.hpp:42
std::uint8_t type
Definition TypeTraits.hpp:1287
std::uint16_t type
Definition TypeTraits.hpp:1296
std::uint32_t type
Definition TypeTraits.hpp:1305
std::uint64_t type
Definition TypeTraits.hpp:1314
Primary template, purposely undefined.
Definition Fwd.hpp:303