NIM PC Cross Platform SDK
载入中...
搜索中...
未找到
ne_stl_type_traits.h
浏览该文件的文档.
1#ifndef NE_STL_INCLUDENE_STL_TYPE_TRAITS_H
2#define NE_STL_INCLUDENE_STL_TYPE_TRAITS_H
3
4#include "ne_stl_build.h"
5
6namespace nstd {
7
8template <typename T, T _value>
10 static const T value = _value;
11 operator T() const { return (value); }
12 T operator()() const { return (value); }
13};
14template <typename T, T _value>
16template <bool _value>
20template <typename T>
21struct is_bool : false_type {};
22template <>
23struct is_bool<bool> : true_type {};
24
25template <bool _conditional, typename T = void>
26struct enable_if {};
27template <typename T>
28struct enable_if<true, T> {
29 using type = T;
30};
31
32template <bool _conditional, typename T1, typename T2>
34 using type = T1;
35};
36template <typename T1, typename T2>
37struct conditional<false, T1, T2> {
38 using type = T2;
39};
40template <typename T>
42 using type = T;
43};
44
45template <typename T>
46struct remove_const<const T> {
47 using type = T;
48};
49template <typename T>
51 using type = T;
52};
53
54template <typename T>
55struct remove_reference<T&> {
56 using type = T;
57};
58
59template <typename T>
60struct remove_reference<T&&> {
61 using type = T;
62};
63template <typename T>
64struct remove_cr {
66};
67template <typename T>
68using is_standard_layout = std::is_standard_layout<T>;
69namespace {
70namespace detail {
71template <typename... TArgs>
72struct _Is_all_standard_layout {};
73template <>
74struct _Is_all_standard_layout<> : nstd::true_type {};
75template <typename T, typename... TArgs>
76struct _Is_all_standard_layout<T, TArgs...> : nstd::conditional<nstd::is_standard_layout<typename nstd::remove_cr<T>::type>::value,
77 _Is_all_standard_layout<TArgs...>,
78 nstd::false_type>::type {};
79} // namespace detail
80namespace traits {
81template <typename... T>
82using _is_all_standard_layout = detail::_Is_all_standard_layout<T...>;
83} // namespace traits
84} // namespace
85template <typename... T>
86using is_all_standard_layout = traits::_is_all_standard_layout<T...>;
87
88} // namespace nstd
89
90#endif // !NE_STL_INCLUDENE_STL_TYPE_TRAITS_H
#define true
Definition: stdbool.h:30
#define false
Definition: stdbool.h:33
unsigned char bool
Definition: stdbool.h:25
Definition: ne_stl_any.h:7
traits::_is_all_standard_layout< T... > is_all_standard_layout
Definition: ne_stl_type_traits.h:86
std::is_standard_layout< T > is_standard_layout
Definition: ne_stl_type_traits.h:68
Definition: ne_stl_type_traits.h:9
static const T value
Definition: ne_stl_type_traits.h:10
T operator()() const
Definition: ne_stl_type_traits.h:12
Definition: ne_stl_type_traits.h:21
Definition: ne_stl_type_traits.h:26
T type
Definition: ne_stl_type_traits.h:29
Definition: ne_stl_type_traits.h:33
T1 type
Definition: ne_stl_type_traits.h:34
T2 type
Definition: ne_stl_type_traits.h:38
Definition: ne_stl_type_traits.h:41
T type
Definition: ne_stl_type_traits.h:42
T type
Definition: ne_stl_type_traits.h:47
Definition: ne_stl_type_traits.h:50
T type
Definition: ne_stl_type_traits.h:51
T type
Definition: ne_stl_type_traits.h:56
T type
Definition: ne_stl_type_traits.h:61
Definition: ne_stl_type_traits.h:64
typename remove_const< typename remove_reference< T >::type >::type type
Definition: ne_stl_type_traits.h:65