@@ -188,6 +188,11 @@ template<class _Tp> inline constexpr bool is_abstract_v = __is_abstract(_Tp);
188188template <class _Tp > using is_abstract = bool_constant<is_abstract_v<_Tp>>;
189189#endif
190190
191+ #if __has_feature(is_final)
192+ template <class _Tp > inline constexpr bool is_final_v = __is_final(_Tp);
193+ template <class _Tp > using is_final = bool_constant<is_final_v<_Tp>>;
194+ #endif
195+
191196template <class > struct is_pointer : false_type {};
192197template <class _Tp > struct is_pointer <_Tp*> : true_type {};
193198template <class _Tp > inline constexpr bool is_pointer_v = is_pointer<_Tp>::value;
@@ -263,6 +268,10 @@ template<class _Tp> struct remove_reference<_Tp&> : type_identity<_Tp> {};
263268template <class _Tp > struct remove_reference <_Tp&&> : type_identity<_Tp> {};
264269template <class _Tp > using remove_reference_t = typename remove_reference<_Tp>::type;
265270
271+ template <class _Tp > using __remove_cvref_t = typename remove_cv<typename remove_reference<_Tp>::type>::type;
272+ template <class _Tp > struct remove_cvref { using type = __remove_cvref_t <_Tp>; };
273+ template <class _Tp > using remove_cvref_t = typename remove_cvref<_Tp>::type;
274+
266275template <class _Tp > auto __add_pointer (int ) -> type_identity<_Tp*>;
267276template <class _Tp > auto __add_pointer (...) -> type_identity<_Tp>;
268277template <class _Tp > using add_pointer = decltype (__add_pointer<_Tp>(0 ));
@@ -278,6 +287,60 @@ template<class _Tp> auto __add_rvalue_reference(...) -> type_identity<_Tp>;
278287template <class _Tp > using add_rvalue_reference = decltype (__add_rvalue_reference<_Tp>(0 ));
279288template <class _Tp > using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type;
280289
290+ // alignment_of:
291+ template <class _Tp > struct alignment_of
292+ : public integral_constant<size_t , alignof (_Tp)> {};
293+ template <class _Tp > inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value;
294+
295+ // rank/extent:
296+ template <class _Tp > struct rank
297+ : public integral_constant<size_t , 0 > {};
298+ template <class _Tp > struct rank <_Tp[]>
299+ : public integral_constant<size_t , rank<_Tp>::value + 1 > {};
300+ template <class _Tp , size_t _Np> struct rank <_Tp[_Np]>
301+ : public integral_constant<size_t , rank<_Tp>::value + 1 > {};
302+ template <class _Tp > inline constexpr size_t rank_v = rank<_Tp>::value;
303+
304+ template <class _Tp , unsigned _Ip = 0 > struct extent
305+ : public integral_constant<size_t , 0 > {};
306+ template <class _Tp > struct extent <_Tp[], 0 >
307+ : public integral_constant<size_t , 0 > {};
308+ template <class _Tp , unsigned _Ip> struct extent <_Tp[], _Ip>
309+ : public integral_constant<size_t , extent<_Tp, _Ip-1 >::value> {};
310+ template <class _Tp , size_t _Np> struct extent <_Tp[_Np], 0 >
311+ : public integral_constant<size_t , _Np> {};
312+ template <class _Tp , size_t _Np, unsigned _Ip> struct extent <_Tp[_Np], _Ip>
313+ : public integral_constant<size_t , extent<_Tp, _Ip-1 >::value> {};
314+ template <class _Tp , unsigned _Ip = 0 > inline constexpr size_t extent_v = extent<_Tp, _Ip>::value;
315+
316+ template <class _Tp > struct remove_extent { typedef _Tp type; };
317+ template <class _Tp > struct remove_extent <_Tp[]> { typedef _Tp type; };
318+ template <class _Tp , size_t _Np> struct remove_extent <_Tp[_Np]> { typedef _Tp type; };
319+ template <class _Tp > using remove_extent_t = typename remove_extent<_Tp>::type;
320+
321+ template <class _Tp > struct remove_all_extents { typedef _Tp type; };
322+ template <class _Tp > struct remove_all_extents <_Tp[]> { typedef typename remove_all_extents<_Tp>::type type; };
323+ template <class _Tp , size_t _Np> struct remove_all_extents <_Tp[_Np]> { typedef typename remove_all_extents<_Tp>::type type; };
324+ template <class _Tp > using remove_all_extents_t = typename remove_all_extents<_Tp>::type;
325+
326+ // decay:
327+ template <class _Tp >
328+ struct decay {
329+ private:
330+ typedef typename std::remove_reference<_Tp>::type _Up;
331+ public:
332+ typedef typename std::conditional<
333+ std::is_array<_Up>::value,
334+ typename std::add_pointer<typename std::remove_extent<_Up>::type>::type,
335+ typename std::conditional<
336+ std::is_function<_Up>::value,
337+ typename std::add_pointer<_Up>::type,
338+ typename std::remove_cv<_Up>::type
339+ >::type
340+ >::type type;
341+ };
342+ template <class _Tp > using decay_t = typename decay<_Tp>::type;
343+
281344// <utility> functions:
282345template <class _Tp > add_rvalue_reference_t <_Tp> declval () noexcept ;
283346
@@ -356,16 +419,20 @@ template<class _Tp> using has_virtual_destructor = bool_constant<has_virtual_des
356419#endif
357420
358421// more <utility> functions:
422+ #if __cplusplus > 201103L
359423template <class _Tp > _EZCXX_INLINE constexpr auto move (_Tp&& __value) noexcept {
360424 return static_cast <remove_reference_t <_Tp>&&>(__value);
361425}
426+ #endif // __cplusplus > 201103L
362427
428+ #if __cplusplus > 201103L
363429template <class _Tp > _EZCXX_INLINE constexpr enable_if_t <is_move_constructible_v<_Tp> && is_move_assignable_v<_Tp>>
364430swap (_Tp& __lhs, _Tp& __rhs) noexcept (is_nothrow_move_constructible_v<_Tp> && is_nothrow_move_assignable_v<_Tp>) {
365431 _Tp __temp (move (__lhs));
366432 __lhs = move (__rhs);
367433 __rhs = move (__temp);
368434}
435+ #endif // __cplusplus > 201103L
369436
370437// swappable classification traits:
371438template <class _Lp , class _Rp > auto __swappable (int ) -> __require<decltype(swap(declval<_Lp>(), declval<_Rp>()))>;
0 commit comments