remove \r
[extl.git] / extl / type / traits / add_volatile.h
blob0500b0242dd85535cef69ea250e92cdc7377fde0
1 /* ///////////////////////////////////////////////////////////////////////
2 * File: add_volatile.h
4 * Created: 08.02.07
5 * Updated: 08.07.09
7 * Brief: add volatile-qualified traits
9 * [<Home>]
10 * Copyright (c) 2008-2020, Waruqi All rights reserved.
11 * //////////////////////////////////////////////////////////////////// */
12 #ifndef EXTL_TYPE_TRAITS_ADD_VOLATILE_H
13 #define EXTL_TYPE_TRAITS_ADD_VOLATILE_H
15 #ifndef EXTL_TYPE_TRAITS_ADD_VOLATILE_SUPPORT
16 # error extl::add_volatile is not supported by current compiler.
17 #endif
19 /* ///////////////////////////////////////////////////////////////////////
20 * Includes
22 #include "prefix.h"
24 #ifdef EXTL_TYPE_TRAITS_IS_REF_SUPPORT
25 # include "is_ref.h"
26 #endif
28 #ifdef EXTL_TYPE_TRAITS_TEST_ENABLE
29 # ifdef EXTL_TYPE_TRAITS_IS_VOLATILE_SUPPORT
30 # include "is_volatile.h"
31 # endif
32 #endif
34 /* ///////////////////////////////////////////////////////////////////////
35 * Macros
37 #define EXTL_ADD_VOLATILE(src_type) EXTL_MODIFY_TYPE(add_volatile, src_type)
39 /* ///////////////////////////////////////////////////////////////////////
40 * ::extl namespace
42 EXTL_BEGIN_NAMESPACE
44 #ifdef EXTL_TYPE_TRAITS_SUPPORT
45 /* //////////////////////////////////////////////////////////////////// */
46 # ifdef EXTL_TEMPLATE_PARTIAL_SPEC_SUPPORT
47 EXTL_TYPE_TRAIT_DEF_1(add_volatile, T volatile)
49 // note: Cannot add volatile-qualified if T is reference
50 EXTL_TYPE_TRAIT_PARTIAL_SPEC_1_1(typename_param_k T, add_volatile, T&, T&)
51 # else
52 template < e_bool_t is_ref >
53 struct add_volatile_helper
55 template < typename_param_k T >
56 struct result
58 typedef T type;
62 EXTL_TEMPLATE_SPECIALISATION
63 struct add_volatile_helper< e_false_v >
65 template < typename_param_k T >
66 struct result
68 typedef T volatile type;
72 template < typename_param_k T >
73 struct add_volatile_impl
74 : add_volatile_helper< (is_ref<T>::value) >::template_qual_k result<T>
78 EXTL_TYPE_TRAIT_DEF_1(add_volatile, typename_type_k add_volatile_impl<T>::type)
80 # endif
82 /* ///////////////////////////////////////////////////////////////////////
83 * Unit-testing
85 # ifdef EXTL_TYPE_TRAITS_TEST_ENABLE
86 # include "unit_test/add_volatile_test.h"
87 # endif
88 #endif
90 /* ///////////////////////////////////////////////////////////////////////
91 * ::extl namespace
93 EXTL_END_NAMESPACE
95 /* //////////////////////////////////////////////////////////////////// */
96 #endif /* EXTL_TYPE_TRAITS_ADD_VOLATILE_H */
97 /* //////////////////////////////////////////////////////////////////// */