1 /* ///////////////////////////////////////////////////////////////////////
2 * File: memory_traits_selector.h
7 * Brief: memory_traits_selector class
10 * Copyright (c) 2008-2020, Waruqi All rights reserved.
11 * //////////////////////////////////////////////////////////////////// */
13 #ifndef EXTL_MEMORY_MEMORY_TRAITS_SELECTOR_H
14 #define EXTL_MEMORY_MEMORY_TRAITS_SELECTOR_H
16 /*!\file memory_traits_selector.h
17 * \brief memory_traits_selector class
20 # error memory_traits_selector.h need be supported by c++.
23 /* ///////////////////////////////////////////////////////////////////////
27 #include "object_memory_traits.h"
28 #include "pod_memory_traits.h"
30 #include "../type/traits/is_arithmetic.h"
32 #ifdef EXTL_TYPE_TRAITS_IS_POD_SUPPORT
33 # include "../type/traits/is_pod.h"
36 #ifdef EXTL_TYPE_TRAITS_IS_SCALAR_SUPPORT
37 # include "../type/traits/is_scalar.h"
40 #ifdef EXTL_MPL_IF_SUPPORT
41 # include "../mpl/if_.h"
44 /* ///////////////////////////////////////////////////////////////////////
49 /*!\brief memory_traits_selector class
51 * \param T The value type
53 * \ingroup extl_group_memory
55 template<typename_param_k T
>
56 struct memory_traits_selector
58 #ifdef EXTL_MPL_IF_SUPPORT
59 #if defined(EXTL_TYPE_TRAITS_IS_POD_SUPPORT)
60 typedef typename_type_k
EXTL_NS_MPL(if_
)< (is_pod
<T
>::value
)
61 , pod_memory_traits
<T
>
62 , object_memory_traits
<T
>
63 >::type memory_traits_type
;
65 #elif defined(EXTL_TYPE_TRAITS_IS_SCALAR_SUPPORT)
66 typedef typename_type_k
EXTL_NS_MPL(if_
)< (is_scalar
<T
>::value
)
67 , pod_memory_traits
<T
>
68 , object_memory_traits
<T
>
69 >::type memory_traits_type
;
72 typedef typename_type_k
EXTL_NS_MPL(if_
)< (is_arithmetic
<T
>::value
)
73 , pod_memory_traits
<T
>
74 , object_memory_traits
<T
>
75 >::type memory_traits_type
;
78 typedef object_memory_traits
<T
> memory_traits_type
;
81 /* ///////////////////////////////////////////////////////////////////////
86 /* //////////////////////////////////////////////////////////////////// */
87 #endif /* EXTL_MEMORY_MEMORY_TRAITS_SELECTOR_H */
88 /* //////////////////////////////////////////////////////////////////// */