remove \r
[extl.git] / extl / memory / memory_traits_selector.h
blob9f89cefdb773ec99288bceb40c8bdbcf76841061
1 /* ///////////////////////////////////////////////////////////////////////
2 * File: memory_traits_selector.h
4 * Created: 08.07.30
5 * Updated: 08.07.30
7 * Brief: memory_traits_selector class
9 * [<Home>]
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
19 #ifndef __cplusplus
20 # error memory_traits_selector.h need be supported by c++.
21 #endif
23 /* ///////////////////////////////////////////////////////////////////////
24 * Includes
26 #include "prefix.h"
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"
34 #endif
36 #ifdef EXTL_TYPE_TRAITS_IS_SCALAR_SUPPORT
37 # include "../type/traits/is_scalar.h"
38 #endif
40 #ifdef EXTL_MPL_IF_SUPPORT
41 # include "../mpl/if_.h"
42 #endif
44 /* ///////////////////////////////////////////////////////////////////////
45 * ::extl namespace
47 EXTL_BEGIN_NAMESPACE
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;
71 #else
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;
76 #endif
77 #else
78 typedef object_memory_traits<T> memory_traits_type;
79 #endif
81 /* ///////////////////////////////////////////////////////////////////////
82 * ::extl namespace
84 EXTL_END_NAMESPACE
86 /* //////////////////////////////////////////////////////////////////// */
87 #endif /* EXTL_MEMORY_MEMORY_TRAITS_SELECTOR_H */
88 /* //////////////////////////////////////////////////////////////////// */