A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
type-traits.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007 INRIA
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 */
18
19#ifndef TYPE_TRAITS_H
20#define TYPE_TRAITS_H
21
22#include "ptr.h"
23
24/**
25 * \file
26 * \ingroup object
27 * ns3::TypeTraits introspection declaration and template implementation.
28 */
29
30namespace ns3
31{
32
33/**
34 * \ingroup object
35 * Inspect a type to deduce its features.
36 * \tparam T \deduced The type to inspect.
37 */
38template <typename T>
40{
41 private:
42 /** Null value type traits. */
43 struct NullType
44 {
45 };
46
47 /**
48 * Not a const type.
49 * \tparam U \deduced The type being inspected.
50 */
51 template <typename U>
52 struct UnConst
53 {
54 typedef U Result; /**< Non-const type. */
55 };
56
57 /**
58 * Const type.
59 * \tparam U \deduced The type being inspected.
60 */
61 template <typename U>
62 struct UnConst<const U>
63 {
64 typedef U Result; /**< Non-const type. */
65 };
66
67 /**
68 * Not a reference type.
69 * \tparam U \deduced The type being inspected.
70 */
71 template <typename U>
73 {
74 /** Value. */
75 enum
76 {
77 IsReference = 0 /**< Not a reference type. */
78 };
79
80 typedef U ReferencedType; /**< Base type. */
81 };
82
83 /**
84 * Reference type.
85 * \tparam U \deduced The type being inspected.
86 */
87 template <typename U>
88 struct ReferenceTraits<U&>
89 {
90 /** Value. */
91 enum
92 {
93 IsReference = 1 /**< Reference type. */
94 };
95
96 typedef U ReferencedType; /**< Base type. */
97 };
98
99 /**
100 * Not a pointer type.
101 * \tparam U \deduced The type being inspected.
102 */
103 template <typename U>
105 {
106 /** Value. */
107 enum
108 {
109 IsPointer = 0, /**< Not a pointer type. */
110 IsPtr = 0 /**< Not a Ptr type. */
111 };
112
113 typedef U PointeeType; /**< Base type. */
114 };
115
116 /**
117 * Pointer type.
118 * \tparam U \deduced The type being inspected.
119 */
120 template <typename U>
121 struct PointerTraits<U*>
122 {
123 /** Value. */
124 enum
125 {
126 IsPointer = 1, /**< Pointer type. */
127 IsPtr = 0 /**< Not a Ptr type. */
128 };
129
130 typedef U PointeeType; /**< Pointee type. */
131 };
132
133 /**
134 * Ptr type.
135 * \tparam U \deduced The type being inspected.
136 */
137 template <typename U>
139 {
140 /** Value. */
141 enum
142 {
143 IsPointer = 0, /**< Not a pointer type. */
144 IsPtr = 1 /**< Ptr type. */
145 };
146
147 typedef U PointeeType; /**< Pointee type. */
148 };
149
150 /**
151 * Base type, after removing \c &, \c * and \c const.
152 * \tparam U \deduced The type being inspected.
153 */
154 template <typename U>
155 struct Base
156 {
157 typedef U Type; /**< Base type. */
158 };
159
160 /**
161 * Base type, after removing \c &.
162 * \tparam U \deduced The type being inspected.
163 */
164 template <typename U>
165 struct Base<U&>
166 {
167 typedef typename Base<U>::Type Type; /**< Base type. */
168 };
169
170 /**
171 * Base type, after removing \c *.
172 * \tparam U \deduced The type being inspected.
173 */
174 template <typename U>
175 struct Base<U*>
176 {
177 typedef typename Base<U>::Type Type; /**< Base type. */
178 };
179
180 /**
181 * Base type, after removing \c const.
182 * \tparam U \deduced The type being inspected.
183 */
184 template <typename U>
185 struct Base<const U>
186 {
187 typedef typename Base<U>::Type Type; /**< Base type. */
188 };
189
190 /**
191 * Base type of a Ptr.
192 * \tparam U \deduced The type being inspected.
193 */
194 template <typename U>
195 struct PtrBase
196 {
197 typedef U Type; /**< Base type. */
198 };
199
200 /**
201 * Base type of a Ptr.
202 * \tparam U \deduced The type being inspected.
203 */
204 template <typename U>
205 struct PtrBase<ns3::Ptr<U>>
206 {
207 typedef U Type; /**< Base type. */
208 };
209
210 /**
211 * Not a function pointer type.
212 * \tparam U \deduced The type being inspected.
213 */
214 template <typename U>
216 {
217 /** Value. */
218 enum
219 {
220 IsFunctionPointer = 0 /**< Not a function pointer. */
221 };
222
223 typedef NullType ReturnType; /**< Return type. */
224 };
225
226 /**
227 * Function pointer type.
228 * \tparam U \deduced Return type.
229 */
230 template <typename U>
231 struct FunctionPtrTraits<U (*)()>
232 {
233 /** Value. */
234 enum
235 {
236 IsFunctionPointer = 1 /**< Function pointer. */
237 };
238
239 /** Value. */ enum
240 {
241 nArgs = 0 /**< Number of arguments. */
242 };
243
244 typedef U ReturnType; /**< Return type. */
245 };
246
247 /**
248 * Function pointer type.
249 * \tparam U \deduced Return type.
250 * \tparam V1 \deduced Argument type.
251 */
252 template <typename U, typename V1>
253 struct FunctionPtrTraits<U (*)(V1)>
254 {
255 /** Value. */
256 enum
257 {
258 IsFunctionPointer = 1 /**< Function pointer. */
259 };
260
261 /** Value. */ enum
262 {
263 nArgs = 1 /**< Number of arguments. */
264 };
265
266 typedef U ReturnType; /**< Return type. */
267 typedef V1 Arg1Type; /**< First argument type. */
268 };
269
270 /**
271 * Function pointer type.
272 * \tparam U \deduced Return type.
273 * \tparam V1 \deduced Argument type.
274 * \tparam V2 \deduced Argument type.
275 */
276 template <typename U, typename V1, typename V2>
277 struct FunctionPtrTraits<U (*)(V1, V2)>
278 {
279 /** Value. */
280 enum
281 {
282 IsFunctionPointer = 1 /**< Function pointer. */
283 };
284
285 /** Value. */ enum
286 {
287 nArgs = 2 /**< Number of arguments. */
288 };
289
290 typedef U ReturnType; /**< Return type. */
291 typedef V1 Arg1Type; /**< First argument type. */
292 typedef V2 Arg2Type; /**< Second argument type. */
293 };
294
295 /**
296 * Function pointer type.
297 * \tparam U \deduced Return type.
298 * \tparam V1 \deduced Argument type.
299 * \tparam V2 \deduced Argument type.
300 * \tparam V3 \deduced Argument type.
301 */
302 template <typename U, typename V1, typename V2, typename V3>
303 struct FunctionPtrTraits<U (*)(V1, V2, V3)>
304 {
305 /** Value. */
306 enum
307 {
308 IsFunctionPointer = 1 /**< Function pointer. */
309 };
310
311 /** Value. */ enum
312 {
313 nArgs = 3 /**< Number of arguments. */
314 };
315
316 typedef U ReturnType; /**< Return type. */
317 typedef V1 Arg1Type; /**< First argument type. */
318 typedef V2 Arg2Type; /**< Second argument type. */
319 typedef V3 Arg3Type; /**< Third argument type. */
320 };
321
322 /**
323 * Function pointer type.
324 * \tparam U \deduced Return type.
325 * \tparam V1 \deduced Argument type.
326 * \tparam V2 \deduced Argument type.
327 * \tparam V3 \deduced Argument type.
328 * \tparam V4 \deduced Argument type.
329 */
330 template <typename U, typename V1, typename V2, typename V3, typename V4>
331 struct FunctionPtrTraits<U (*)(V1, V2, V3, V4)>
332 {
333 /** Value. */
334 enum
335 {
336 IsFunctionPointer = 1 /**< Function pointer. */
337 };
338
339 /** Value. */ enum
340 {
341 nArgs = 4 /**< Number of arguments. */
342 };
343
344 typedef U ReturnType; /**< Return type. */
345 typedef V1 Arg1Type; /**< First argument type. */
346 typedef V2 Arg2Type; /**< Second argument type. */
347 typedef V3 Arg3Type; /**< Third argument type. */
348 typedef V4 Arg4Type; /**< Fourth argument type. */
349 };
350
351 /**
352 * Function pointer type.
353 * \tparam U \deduced Return type.
354 * \tparam V1 \deduced Argument type.
355 * \tparam V2 \deduced Argument type.
356 * \tparam V3 \deduced Argument type.
357 * \tparam V4 \deduced Argument type.
358 * \tparam V5 \deduced Argument type.
359 */
360 template <typename U, typename V1, typename V2, typename V3, typename V4, typename V5>
361 struct FunctionPtrTraits<U (*)(V1, V2, V3, V4, V5)>
362 {
363 /** Value. */
364 enum
365 {
366 IsFunctionPointer = 1 /**< Function pointer. */
367 };
368
369 /** Value. */ enum
370 {
371 nArgs = 5 /**< Number of arguments. */
372 };
373
374 typedef U ReturnType; /**< Return type. */
375 typedef V1 Arg1Type; /**< First argument type. */
376 typedef V2 Arg2Type; /**< Second argument type. */
377 typedef V3 Arg3Type; /**< Third argument type. */
378 typedef V4 Arg4Type; /**< Fourth argument type. */
379 typedef V5 Arg5Type; /**< Fifth argument type. */
380 };
381
382 /**
383 * Function pointer type.
384 * \tparam U \deduced Return type.
385 * \tparam V1 \deduced Argument type.
386 * \tparam V2 \deduced Argument type.
387 * \tparam V3 \deduced Argument type.
388 * \tparam V4 \deduced Argument type.
389 * \tparam V5 \deduced Argument type.
390 * \tparam V6 \deduced Argument type.
391 */
392 template <typename U,
393 typename V1,
394 typename V2,
395 typename V3,
396 typename V4,
397 typename V5,
398 typename V6>
399 struct FunctionPtrTraits<U (*)(V1, V2, V3, V4, V5, V6)>
400 {
401 /** Value. */
402 enum
403 {
404 IsFunctionPointer = 1 /**< Function pointer. */
405 };
406
407 /** Value. */ enum
408 {
409 nArgs = 6 /**< Number of arguments. */
410 };
411
412 typedef U ReturnType; /**< Return type. */
413 typedef V1 Arg1Type; /**< First argument type. */
414 typedef V2 Arg2Type; /**< Second argument type. */
415 typedef V3 Arg3Type; /**< Third argument type. */
416 typedef V4 Arg4Type; /**< Fourth argument type. */
417 typedef V5 Arg5Type; /**< Fifth argument type. */
418 typedef V6 Arg6Type; /**< Sixth argument type. */
419 };
420
421 /**
422 * Not a pointer to member type.
423 * \tparam U \deduced Return type.
424 */
425 template <typename U>
427 {
428 /** Value. */
429 enum
430 {
431 IsPointerToMember = 0 /**< Not a pointer to member. */
432 };
433 };
434
435 /**
436 * Pointer to member function.
437 * \tparam U \deduced Return type.
438 * \tparam V \deduced Class type.
439 */
440 template <typename U, typename V>
441 struct PtrToMemberTraits<U (V::*)()>
442 {
443 /** Value. */
444 enum
445 {
446 IsPointerToMember = 1 /**< Pointer to member function. */
447 };
448
449 /** Value. */ enum
450 {
451 nArgs = 0 /**< Number of arguments. */
452 };
453
454 typedef U ReturnType; /**< Return type. */
455 };
456
457 /**
458 * Pointer to const member function.
459 * \tparam U \deduced Return type.
460 * \tparam V \deduced Class type.
461 */
462 template <typename U, typename V>
463 struct PtrToMemberTraits<U (V::*)() const>
464 {
465 /** Value. */
466 enum
467 {
468 IsPointerToMember = 1 /**< Pointer to member function. */
469 };
470
471 /** Value. */ enum
472 {
473 nArgs = 0 /**< Number of arguments. */
474 };
475
476 typedef U ReturnType; /**< Return type. */
477 };
478
479 /**
480 * Pointer to member function.
481 * \tparam U \deduced Return type.
482 * \tparam V \deduced Class type.
483 * \tparam W1 \deduced Argument type.
484 */
485 template <typename U, typename V, typename W1>
486 struct PtrToMemberTraits<U (V::*)(W1)>
487 {
488 /** Value. */
489 enum
490 {
491 IsPointerToMember = 1 /**< Pointer to member function. */
492 };
493
494 /** Value. */ enum
495 {
496 nArgs = 1 /**< Number of arguments. */
497 };
498
499 typedef U ReturnType; /**< Return type. */
500 typedef W1 Arg1Type; /**< First argument type. */
501 };
502
503 /**
504 * Pointer to const member function.
505 * \tparam U \deduced Return type.
506 * \tparam V \deduced Class type.
507 * \tparam W1 \deduced Argument type.
508 */
509 template <typename U, typename V, typename W1>
510 struct PtrToMemberTraits<U (V::*)(W1) const>
511 {
512 /** Value. */
513 enum
514 {
515 IsPointerToMember = 1 /**< Pointer to member function. */
516 };
517
518 /** Value. */ enum
519 {
520 nArgs = 1 /**< Number of arguments. */
521 };
522
523 typedef U ReturnType; /**< Return type. */
524 typedef W1 Arg1Type; /**< First argument type. */
525 };
526
527 /**
528 * Pointer to member function.
529 * \tparam U \deduced Return type.
530 * \tparam V \deduced Class type.
531 * \tparam W1 \deduced Argument type.
532 * \tparam W2 \deduced Argument type.
533 */
534 template <typename U, typename V, typename W1, typename W2>
535 struct PtrToMemberTraits<U (V::*)(W1, W2)>
536 {
537 /** Value. */
538 enum
539 {
540 IsPointerToMember = 1 /**< Pointer to member function. */
541 };
542
543 /** Value. */ enum
544 {
545 nArgs = 2 /**< Number of arguments. */
546 };
547
548 typedef U ReturnType; /**< Return type. */
549 typedef W1 Arg1Type; /**< First argument type. */
550 typedef W2 Arg2Type; /**< Second argument type. */
551 };
552
553 /**
554 * Pointer to const member function.
555 * \tparam U \deduced Return type.
556 * \tparam V \deduced Class type.
557 * \tparam W1 \deduced Argument type.
558 * \tparam W2 \deduced Argument type.
559 */
560 template <typename U, typename V, typename W1, typename W2>
561 struct PtrToMemberTraits<U (V::*)(W1, W2) const>
562 {
563 /** Value. */
564 enum
565 {
566 IsPointerToMember = 1 /**< Pointer to member function. */
567 };
568
569 /** Value. */ enum
570 {
571 nArgs = 2 /**< Number of arguments. */
572 };
573
574 typedef U ReturnType; /**< Return type. */
575 typedef W1 Arg1Type; /**< First argument type. */
576 typedef W2 Arg2Type; /**< Second argument type. */
577 };
578
579 /**
580 * Pointer to member function.
581 * \tparam U \deduced Return type.
582 * \tparam V \deduced Class type.
583 * \tparam W1 \deduced Argument type.
584 * \tparam W2 \deduced Argument type.
585 * \tparam W3 \deduced Argument type.
586 */
587 template <typename U, typename V, typename W1, typename W2, typename W3>
588 struct PtrToMemberTraits<U (V::*)(W1, W2, W3)>
589 {
590 /** Value. */
591 enum
592 {
593 IsPointerToMember = 1 /**< Pointer to member function. */
594 };
595
596 /** Value. */ enum
597 {
598 nArgs = 3 /**< Number of arguments. */
599 };
600
601 typedef U ReturnType; /**< Return type. */
602 typedef W1 Arg1Type; /**< First argument type. */
603 typedef W2 Arg2Type; /**< Second argument type. */
604 typedef W3 Arg3Type; /**< Third argument type. */
605 };
606
607 /**
608 * Pointer to const member function.
609 * \tparam U \deduced Return type.
610 * \tparam V \deduced Class type.
611 * \tparam W1 \deduced Argument type.
612 * \tparam W2 \deduced Argument type.
613 * \tparam W3 \deduced Argument type.
614 */
615 template <typename U, typename V, typename W1, typename W2, typename W3>
616 struct PtrToMemberTraits<U (V::*)(W1, W2, W3) const>
617 {
618 /** Value. */
619 enum
620 {
621 IsPointerToMember = 1 /**< Pointer to member function. */
622 };
623
624 /** Value. */ enum
625 {
626 nArgs = 3 /**< Number of arguments. */
627 };
628
629 typedef U ReturnType; /**< Return type. */
630 typedef W1 Arg1Type; /**< First argument type. */
631 typedef W2 Arg2Type; /**< Second argument type. */
632 typedef W3 Arg3Type; /**< Third argument type. */
633 };
634
635 /**
636 * Pointer to member function.
637 * \tparam U \deduced Return type.
638 * \tparam V \deduced Class type.
639 * \tparam W1 \deduced Argument type.
640 * \tparam W2 \deduced Argument type.
641 * \tparam W3 \deduced Argument type.
642 * \tparam W4 \deduced Argument type.
643 */
644 template <typename U, typename V, typename W1, typename W2, typename W3, typename W4>
645 struct PtrToMemberTraits<U (V::*)(W1, W2, W3, W4)>
646 {
647 /** Value. */
648 enum
649 {
650 IsPointerToMember = 1 /**< Pointer to member function. */
651 };
652
653 /** Value. */ enum
654 {
655 nArgs = 4 /**< Number of arguments. */
656 };
657
658 typedef U ReturnType; /**< Return type. */
659 typedef W1 Arg1Type; /**< First argument type. */
660 typedef W2 Arg2Type; /**< Second argument type. */
661 typedef W3 Arg3Type; /**< Third argument type. */
662 typedef W4 Arg4Type; /**< Fourth argument type. */
663 };
664
665 /**
666 * Pointer to const member function.
667 * \tparam U \deduced Return type.
668 * \tparam V \deduced Class type.
669 * \tparam W1 \deduced Argument type.
670 * \tparam W2 \deduced Argument type.
671 * \tparam W3 \deduced Argument type.
672 * \tparam W4 \deduced Argument type.
673 */
674 template <typename U, typename V, typename W1, typename W2, typename W3, typename W4>
675 struct PtrToMemberTraits<U (V::*)(W1, W2, W3, W4) const>
676 {
677 /** Value. */
678 enum
679 {
680 IsPointerToMember = 1 /**< Pointer to member function. */
681 };
682
683 /** Value. */ enum
684 {
685 nArgs = 4 /**< Number of arguments. */
686 };
687
688 typedef U ReturnType; /**< Return type. */
689 typedef W1 Arg1Type; /**< First argument type. */
690 typedef W2 Arg2Type; /**< Second argument type. */
691 typedef W3 Arg3Type; /**< Third argument type. */
692 typedef W4 Arg4Type; /**< Fourth argument type. */
693 };
694
695 /**
696 * Pointer to member function.
697 * \tparam U \deduced Return type.
698 * \tparam V \deduced Class type.
699 * \tparam W1 \deduced Argument type.
700 * \tparam W2 \deduced Argument type.
701 * \tparam W3 \deduced Argument type.
702 * \tparam W4 \deduced Argument type.
703 * \tparam W5 \deduced Argument type.
704 */
705 template <typename U,
706 typename V,
707 typename W1,
708 typename W2,
709 typename W3,
710 typename W4,
711 typename W5>
712 struct PtrToMemberTraits<U (V::*)(W1, W2, W3, W4, W5)>
713 {
714 /** Value. */
715 enum
716 {
717 IsPointerToMember = 1 /**< Pointer to member function. */
718 };
719
720 /** Value. */ enum
721 {
722 nArgs = 5 /**< Number of arguments. */
723 };
724
725 typedef U ReturnType; /**< Return type. */
726 typedef W1 Arg1Type; /**< First argument type. */
727 typedef W2 Arg2Type; /**< Second argument type. */
728 typedef W3 Arg3Type; /**< Third argument type. */
729 typedef W4 Arg4Type; /**< Fourth argument type. */
730 typedef W5 Arg5Type; /**< Fifth argument type. */
731 };
732
733 /**
734 * Pointer to const member function.
735 * \tparam U \deduced Return type.
736 * \tparam V \deduced Class type.
737 * \tparam W1 \deduced Argument type.
738 * \tparam W2 \deduced Argument type.
739 * \tparam W3 \deduced Argument type.
740 * \tparam W4 \deduced Argument type.
741 * \tparam W5 \deduced Argument type.
742 */
743 template <typename U,
744 typename V,
745 typename W1,
746 typename W2,
747 typename W3,
748 typename W4,
749 typename W5>
750 struct PtrToMemberTraits<U (V::*)(W1, W2, W3, W4, W5) const>
751 {
752 /** Value. */
753 enum
754 {
755 IsPointerToMember = 1 /**< Pointer to member function. */
756 };
757
758 /** Value. */ enum
759 {
760 nArgs = 5 /**< Number of arguments. */
761 };
762
763 typedef U ReturnType; /**< Return type. */
764 typedef W1 Arg1Type; /**< First argument type. */
765 typedef W2 Arg2Type; /**< Second argument type. */
766 typedef W3 Arg3Type; /**< Third argument type. */
767 typedef W4 Arg4Type; /**< Fourth argument type. */
768 typedef W5 Arg5Type; /**< Fifth argument type. */
769 };
770
771 /**
772 * Pointer to member function.
773 * \tparam U \deduced Return type.
774 * \tparam V \deduced Class type.
775 * \tparam W1 \deduced Argument type.
776 * \tparam W2 \deduced Argument type.
777 * \tparam W3 \deduced Argument type.
778 * \tparam W4 \deduced Argument type.
779 * \tparam W5 \deduced Argument type.
780 * \tparam W6 \deduced Argument type.
781 */
782 template <typename U,
783 typename V,
784 typename W1,
785 typename W2,
786 typename W3,
787 typename W4,
788 typename W5,
789 typename W6>
790 struct PtrToMemberTraits<U (V::*)(W1, W2, W3, W4, W5, W6)>
791 {
792 /** Value. */
793 enum
794 {
795 IsPointerToMember = 1 /**< Pointer to member function. */
796 };
797
798 /** Value. */ enum
799 {
800 nArgs = 6 /**< Number of arguments. */
801 };
802
803 typedef U ReturnType; /**< Return type. */
804 typedef W1 Arg1Type; /**< First argument type. */
805 typedef W2 Arg2Type; /**< Second argument type. */
806 typedef W3 Arg3Type; /**< Third argument type. */
807 typedef W4 Arg4Type; /**< Fourth argument type. */
808 typedef W5 Arg5Type; /**< Fifth argument type. */
809 typedef W6 Arg6Type; /**< Sixth argument type. */
810 };
811
812 /**
813 * Pointer to const member function.
814 * \tparam U \deduced Return type.
815 * \tparam V \deduced Class type.
816 * \tparam W1 \deduced Argument type.
817 * \tparam W2 \deduced Argument type.
818 * \tparam W3 \deduced Argument type.
819 * \tparam W4 \deduced Argument type.
820 * \tparam W5 \deduced Argument type.
821 * \tparam W6 \deduced Argument type.
822 */
823 template <typename U,
824 typename V,
825 typename W1,
826 typename W2,
827 typename W3,
828 typename W4,
829 typename W5,
830 typename W6>
831 struct PtrToMemberTraits<U (V::*)(W1, W2, W3, W4, W5, W6) const>
832 {
833 /** Value. */
834 enum
835 {
836 IsPointerToMember = 1 /**< Pointer to member function. */
837 };
838
839 /** Value. */ enum
840 {
841 nArgs = 6 /**< Number of arguments. */
842 };
843
844 typedef U ReturnType; /**< Return type. */
845 typedef W1 Arg1Type; /**< First argument type. */
846 typedef W2 Arg2Type; /**< Second argument type. */
847 typedef W3 Arg3Type; /**< Third argument type. */
848 typedef W4 Arg4Type; /**< Fourth argument type. */
849 typedef W5 Arg5Type; /**< Fifth argument type. */
850 typedef W6 Arg6Type; /**< Sixth argument type. */
851 };
852
853 public:
854 /** Not a const type. */
856 /** Referenced type. */
858 /** Pointee type. */
860 /** Base type, after removing \c &, \c * and \c const. */
861 typedef typename Base<T>::Type BaseType;
862 /** Ptr base type. */
864
865 /** Predicates. */
866 enum
867 {
868 /** Pointer to member predicate. */
870 /** Pointer predicate. */
872 /** Ptr predicate. */
874 /** Reference predicate. */
876 /** Function pointer predicate. */
878 };
879
880 /** Pointer to member traits type. */
882 /** Function pointer traits. */
884};
885
886} // namespace ns3
887
888#endif /* TYPE_TRAITS_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Ptr smart pointer declaration and implementation.
Base< U >::Type Type
Base type.
Definition: type-traits.h:177
Base< U >::Type Type
Base type.
Definition: type-traits.h:167
Base< U >::Type Type
Base type.
Definition: type-traits.h:187
Base type, after removing &, * and const.
Definition: type-traits.h:156
Not a function pointer type.
Definition: type-traits.h:216
NullType ReturnType
Return type.
Definition: type-traits.h:223
@ IsFunctionPointer
Not a function pointer.
Definition: type-traits.h:220
Null value type traits.
Definition: type-traits.h:44
@ IsPointer
Not a pointer type.
Definition: type-traits.h:109
Base type of a Ptr.
Definition: type-traits.h:196
Not a pointer to member type.
Definition: type-traits.h:427
@ IsPointerToMember
Not a pointer to member.
Definition: type-traits.h:431
Not a reference type.
Definition: type-traits.h:73
@ IsReference
Not a reference type.
Definition: type-traits.h:77
Not a const type.
Definition: type-traits.h:53
U Result
Non-const type.
Definition: type-traits.h:54
Inspect a type to deduce its features.
Definition: type-traits.h:40
ReferenceTraits< T >::ReferencedType ReferencedType
Referenced type.
Definition: type-traits.h:857
@ IsPtr
Ptr predicate.
Definition: type-traits.h:873
@ IsFunctionPointer
Function pointer predicate.
Definition: type-traits.h:877
@ IsPointerToMember
Pointer to member predicate.
Definition: type-traits.h:869
@ IsReference
Reference predicate.
Definition: type-traits.h:875
@ IsPointer
Pointer predicate.
Definition: type-traits.h:871
PtrToMemberTraits< T > PointerToMemberTraits
Pointer to member traits type.
Definition: type-traits.h:881
PtrBase< T >::Type PtrBaseType
Ptr base type.
Definition: type-traits.h:863
FunctionPtrTraits< T > FunctionPointerTraits
Function pointer traits.
Definition: type-traits.h:883
Base< T >::Type BaseType
Base type, after removing &, * and const.
Definition: type-traits.h:861
PointerTraits< T >::PointeeType PointeeType
Pointee type.
Definition: type-traits.h:859
UnConst< T >::Result NonConstType
Not a const type.
Definition: type-traits.h:855