|
86 | 86 | * Use in the public section of the class. |
87 | 87 | */ |
88 | 88 | #define FUSE_SMART_PTR_DEFINITIONS(...) \ |
89 | | - __FUSE_SHARED_PTR_ALIAS(__VA_ARGS__) \ |
90 | | - __FUSE_MAKE_SHARED_DEFINITION(__VA_ARGS__) \ |
91 | | - __FUSE_WEAK_PTR_ALIAS(__VA_ARGS__) \ |
92 | | - __FUSE_UNIQUE_PTR_ALIAS(__VA_ARGS__) \ |
93 | | - __FUSE_MAKE_UNIQUE_DEFINITION(__VA_ARGS__) |
| 89 | + __FUSE_SHARED_PTR_ALIAS(__VA_ARGS__) \ |
| 90 | + __FUSE_MAKE_SHARED_DEFINITION(__VA_ARGS__) \ |
| 91 | + __FUSE_WEAK_PTR_ALIAS(__VA_ARGS__) \ |
| 92 | + __FUSE_UNIQUE_PTR_ALIAS(__VA_ARGS__) \ |
| 93 | + __FUSE_MAKE_UNIQUE_DEFINITION(__VA_ARGS__) |
94 | 94 |
|
95 | 95 | /** |
96 | 96 | * Defines smart pointer aliases and static functions for a class that contains fixed-sized |
|
104 | 104 | */ |
105 | 105 | #if __cpp_aligned_new |
106 | 106 | #define FUSE_SMART_PTR_DEFINITIONS_WITH_EIGEN(...) \ |
107 | | - FUSE_SMART_PTR_DEFINITIONS(__VA_ARGS__) |
| 107 | + FUSE_SMART_PTR_DEFINITIONS(__VA_ARGS__) |
108 | 108 | #else |
109 | 109 | #define FUSE_SMART_PTR_DEFINITIONS_WITH_EIGEN(...) \ |
110 | | - EIGEN_MAKE_ALIGNED_OPERATOR_NEW \ |
111 | | - __FUSE_SHARED_PTR_ALIAS(__VA_ARGS__) \ |
112 | | - __FUSE_MAKE_SHARED_ALIGNED_DEFINITION(__VA_ARGS__) \ |
113 | | - __FUSE_WEAK_PTR_ALIAS(__VA_ARGS__) \ |
114 | | - __FUSE_UNIQUE_PTR_ALIAS(__VA_ARGS__) \ |
115 | | - __FUSE_MAKE_UNIQUE_DEFINITION(__VA_ARGS__) |
| 110 | + EIGEN_MAKE_ALIGNED_OPERATOR_NEW \ |
| 111 | + __FUSE_SHARED_PTR_ALIAS(__VA_ARGS__) \ |
| 112 | + __FUSE_MAKE_SHARED_ALIGNED_DEFINITION(__VA_ARGS__) \ |
| 113 | + __FUSE_WEAK_PTR_ALIAS(__VA_ARGS__) \ |
| 114 | + __FUSE_UNIQUE_PTR_ALIAS(__VA_ARGS__) \ |
| 115 | + __FUSE_MAKE_UNIQUE_DEFINITION(__VA_ARGS__) |
116 | 116 | #endif |
117 | 117 |
|
118 | 118 | /** |
|
124 | 124 | * Use in the public section of the class. |
125 | 125 | */ |
126 | 126 | #define FUSE_SMART_PTR_ALIASES_ONLY(...) \ |
127 | | - __FUSE_SHARED_PTR_ALIAS(__VA_ARGS__) \ |
128 | | - __FUSE_WEAK_PTR_ALIAS(__VA_ARGS__) \ |
129 | | - __FUSE_UNIQUE_PTR_ALIAS(__VA_ARGS__) |
| 127 | + __FUSE_SHARED_PTR_ALIAS(__VA_ARGS__) \ |
| 128 | + __FUSE_WEAK_PTR_ALIAS(__VA_ARGS__) \ |
| 129 | + __FUSE_UNIQUE_PTR_ALIAS(__VA_ARGS__) |
130 | 130 |
|
131 | 131 | #define __FUSE_SHARED_PTR_ALIAS(...) \ |
132 | | - using SharedPtr = std::shared_ptr<__VA_ARGS__>; \ |
133 | | - using ConstSharedPtr = std::shared_ptr<const __VA_ARGS__>; |
| 132 | + using SharedPtr = std::shared_ptr<__VA_ARGS__>; \ |
| 133 | + using ConstSharedPtr = std::shared_ptr<const __VA_ARGS__>; |
134 | 134 |
|
135 | 135 | #define __FUSE_MAKE_SHARED_DEFINITION(...) \ |
136 | | - template<typename ... Args> \ |
137 | | - static std::shared_ptr<__VA_ARGS__> \ |
138 | | - make_shared(Args && ... args) \ |
139 | | - { \ |
140 | | - return std::make_shared<__VA_ARGS__>(std::forward<Args>(args) ...); \ |
141 | | - } |
| 136 | + template<typename ... Args> \ |
| 137 | + static std::shared_ptr<__VA_ARGS__> \ |
| 138 | + make_shared(Args && ... args) \ |
| 139 | + { \ |
| 140 | + return std::make_shared<__VA_ARGS__>(std::forward<Args>(args) ...); \ |
| 141 | + } |
142 | 142 |
|
143 | 143 | #define __FUSE_MAKE_SHARED_ALIGNED_DEFINITION(...) \ |
144 | | - template<typename ... Args> \ |
145 | | - static std::shared_ptr<__VA_ARGS__> \ |
146 | | - make_shared(Args && ... args) \ |
147 | | - { \ |
148 | | - return std::allocate_shared<__VA_ARGS__>( \ |
149 | | - Eigen::aligned_allocator<__VA_ARGS__>(), \ |
150 | | - std::forward<Args>(args) ...); \ |
151 | | - } |
| 144 | + template<typename ... Args> \ |
| 145 | + static std::shared_ptr<__VA_ARGS__> \ |
| 146 | + make_shared(Args && ... args) \ |
| 147 | + { \ |
| 148 | + return std::allocate_shared<__VA_ARGS__>( \ |
| 149 | + Eigen::aligned_allocator<__VA_ARGS__>(), \ |
| 150 | + std::forward<Args>(args) ...); \ |
| 151 | + } |
152 | 152 |
|
153 | 153 | #define __FUSE_WEAK_PTR_ALIAS(...) \ |
154 | | - using WeakPtr = std::weak_ptr<__VA_ARGS__>; \ |
155 | | - using ConstWeakPtr = std::weak_ptr<const __VA_ARGS__>; |
| 154 | + using WeakPtr = std::weak_ptr<__VA_ARGS__>; \ |
| 155 | + using ConstWeakPtr = std::weak_ptr<const __VA_ARGS__>; |
156 | 156 |
|
157 | 157 | #define __FUSE_UNIQUE_PTR_ALIAS(...) \ |
158 | | - using UniquePtr = std::unique_ptr<__VA_ARGS__>; |
| 158 | + using UniquePtr = std::unique_ptr<__VA_ARGS__>; |
159 | 159 |
|
160 | 160 | #if __cplusplus >= 201402L |
161 | 161 | #define __FUSE_MAKE_UNIQUE_DEFINITION(...) \ |
162 | | - template<typename ... Args> \ |
163 | | - static std::unique_ptr<__VA_ARGS__> \ |
164 | | - make_unique(Args && ... args) \ |
165 | | - { \ |
166 | | - return std::make_unique<__VA_ARGS__>(std::forward<Args>(args) ...); \ |
167 | | - } |
| 162 | + template<typename ... Args> \ |
| 163 | + static std::unique_ptr<__VA_ARGS__> \ |
| 164 | + make_unique(Args && ... args) \ |
| 165 | + { \ |
| 166 | + return std::make_unique<__VA_ARGS__>(std::forward<Args>(args) ...); \ |
| 167 | + } |
168 | 168 | #else |
169 | 169 | #define __FUSE_MAKE_UNIQUE_DEFINITION(...) \ |
170 | | - template<typename ... Args> \ |
171 | | - static std::unique_ptr<__VA_ARGS__> \ |
172 | | - make_unique(Args && ... args) \ |
173 | | - { \ |
174 | | - return std::unique_ptr<__VA_ARGS__>(new __VA_ARGS__(std::forward<Args>(args) ...)); \ |
175 | | - } |
| 170 | + template<typename ... Args> \ |
| 171 | + static std::unique_ptr<__VA_ARGS__> \ |
| 172 | + make_unique(Args && ... args) \ |
| 173 | + { \ |
| 174 | + return std::unique_ptr<__VA_ARGS__>(new __VA_ARGS__(std::forward<Args>(args) ...)); \ |
| 175 | + } |
176 | 176 | #endif |
177 | 177 |
|
178 | 178 | #endif // FUSE_CORE__FUSE_MACROS_HPP_ |
0 commit comments