Classdesc 3.44
typeName_epilogue.h
1/*
2 @copyright Russell Standish 2000-2013
3 @author Russell Standish
4 This file is part of Classdesc
5
6 Open source licensed under the MIT license. See LICENSE for details.
7*/
8
9#ifndef CLASSDESC_TYPENAME_EPILOGUE_H
10#define CLASSDESC_TYPENAME_EPILOGUE_H
11#include "classdesc.h"
12#include "typeName-allCDs.h"
13
14namespace classdesc
15{
16 // generically handle new integral types
17 template <class T> typename
18 enable_if< Not<is_const<T> >,std::string>::T
19 integralTypeName()
20 {
21 std::ostringstream os;
22 os<<CHAR_BIT*sizeof(T);
23 return (is_unsigned<T>::value?"unsigned int":"int")+os.str()+"_t";
24 }
25
26 template <class T> typename
27 enable_if<And<Not<is_const<T> >,is_integral<T> >,std::string>::T
28 typeNamep() {return integralTypeName<T>();}
29
30#if defined(__cplusplus) && __cplusplus>=201103L
31 template <class T>
32 struct tn<T, void_t<typename std::iterator_traits<T>::value_type>>
33 {
34 static std::string name() {return "iterator";}
35 };
36#endif
37
38 template <class T> typename
40 And<
43 >,std::string>::T
44 typeNamep() {return tn<T>::name();}
45
46 template <class T> typename
47 enable_if<is_const<T>,std::string>::T
48 typeNamep() {return "const "+typeName<typename remove_const<T>::type>();}
49
50 template <class T>
52 typeName() {return typeNamep<T>();}
53
54#if defined(__cplusplus) && __cplusplus>=201103L
55 template <class T>
56 struct tn<T&&>
57 {
58 static std::string name() {return typeName<T>();}
59 };
60#endif
61}
62
63#endif
Contains definitions related to classdesc functionality.
Definition classdesc.h:420
Definition classdesc.h:405
controlled template specialisation: stolen from boost::enable_if.
Definition classdesc.h:282
Definition classdesc.h:571