|
25 | 25 | #ifndef SHARE_OOPS_OOPSHIERARCHY_HPP |
26 | 26 | #define SHARE_OOPS_OOPSHIERARCHY_HPP |
27 | 27 |
|
28 | | -#include "metaprogramming/integralConstant.hpp" |
29 | 28 | #include "metaprogramming/primitiveConversions.hpp" |
30 | 29 | #include "utilities/globalDefinitions.hpp" |
31 | 30 |
|
| 31 | +#include <type_traits> |
| 32 | + |
32 | 33 | // OBJECT hierarchy |
33 | 34 | // This hierarchy is a representation hierarchy, i.e. if A is a superclass |
34 | 35 | // of B, A's representation is a prefix of B's representation. |
@@ -107,39 +108,39 @@ class oop { |
107 | 108 | }; |
108 | 109 |
|
109 | 110 | template<> |
110 | | -struct PrimitiveConversions::Translate<oop> : public TrueType { |
| 111 | +struct PrimitiveConversions::Translate<oop> : public std::true_type { |
111 | 112 | typedef oop Value; |
112 | 113 | typedef oopDesc* Decayed; |
113 | 114 |
|
114 | 115 | static Decayed decay(Value x) { return x.obj(); } |
115 | 116 | static Value recover(Decayed x) { return oop(x); } |
116 | 117 | }; |
117 | 118 |
|
118 | | -#define DEF_OOP(type) \ |
119 | | - class type##OopDesc; \ |
120 | | - class type##Oop : public oop { \ |
121 | | - public: \ |
122 | | - type##Oop() : oop() {} \ |
123 | | - type##Oop(const type##Oop& o) : oop(o) {} \ |
124 | | - type##Oop(const oop& o) : oop(o) {} \ |
125 | | - type##Oop(type##OopDesc* o) : oop((oopDesc*)o) {} \ |
126 | | - operator type##OopDesc* () const { return (type##OopDesc*)obj(); } \ |
127 | | - type##OopDesc* operator->() const { \ |
128 | | - return (type##OopDesc*)obj(); \ |
129 | | - } \ |
130 | | - type##Oop& operator=(const type##Oop& o) { \ |
131 | | - oop::operator=(o); \ |
132 | | - return *this; \ |
133 | | - } \ |
134 | | - }; \ |
135 | | - \ |
136 | | - template<> \ |
137 | | - struct PrimitiveConversions::Translate<type##Oop> : public TrueType { \ |
138 | | - typedef type##Oop Value; \ |
139 | | - typedef type##OopDesc* Decayed; \ |
140 | | - \ |
141 | | - static Decayed decay(Value x) { return (type##OopDesc*)x.obj(); } \ |
142 | | - static Value recover(Decayed x) { return type##Oop(x); } \ |
| 119 | +#define DEF_OOP(type) \ |
| 120 | + class type##OopDesc; \ |
| 121 | + class type##Oop : public oop { \ |
| 122 | + public: \ |
| 123 | + type##Oop() : oop() {} \ |
| 124 | + type##Oop(const type##Oop& o) : oop(o) {} \ |
| 125 | + type##Oop(const oop& o) : oop(o) {} \ |
| 126 | + type##Oop(type##OopDesc* o) : oop((oopDesc*)o) {} \ |
| 127 | + operator type##OopDesc* () const { return (type##OopDesc*)obj(); } \ |
| 128 | + type##OopDesc* operator->() const { \ |
| 129 | + return (type##OopDesc*)obj(); \ |
| 130 | + } \ |
| 131 | + type##Oop& operator=(const type##Oop& o) { \ |
| 132 | + oop::operator=(o); \ |
| 133 | + return *this; \ |
| 134 | + } \ |
| 135 | + }; \ |
| 136 | + \ |
| 137 | + template<> \ |
| 138 | + struct PrimitiveConversions::Translate<type##Oop> : public std::true_type { \ |
| 139 | + typedef type##Oop Value; \ |
| 140 | + typedef type##OopDesc* Decayed; \ |
| 141 | + \ |
| 142 | + static Decayed decay(Value x) { return (type##OopDesc*)x.obj(); } \ |
| 143 | + static Value recover(Decayed x) { return type##Oop(x); } \ |
143 | 144 | }; |
144 | 145 |
|
145 | 146 | DEF_OOP(instance); |
|
0 commit comments