sigx++  2.0.1
const_trait.h
Go to the documentation of this file.
1 #ifndef _SIGX_CONST_TRAIT_HPP_
2 #define _SIGX_CONST_TRAIT_HPP_
3 
4 /*
5  * Copyright 2006 Klaus Triendl
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the Free
19  * Software Foundation, 51 Franklin Street, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21 */
22 
23 /*
24  * Inspired by Andrei Alexandrescu's article "volatile - Multithreaded
25  * Programmer's Best Friend":
26  * http://www.ddj.com/dept/cpp/184403766
27 */
28 
29 
30 namespace sigx
31 {
32 
39 template<typename T_type>
41 {
42  typedef const T_type add;
43  typedef T_type remove;
44 };
45 
48 template<typename T_type>
49 struct const_trait<const T_type>
50 {
51  typedef const T_type add;
52  typedef T_type remove;
53 };
54 
95 template<typename T_type>
96 struct const_trait<T_type&>
97 {
98  typedef const T_type& add;
99  typedef T_type& remove;
100 };
101 
104 template<typename T_type>
105 struct const_trait<const T_type&>
106 {
107  typedef const T_type& add;
108  typedef T_type& remove;
109 };
110 
111 
112 
113 // @addtogroup threadsafety
117 } // namespace sigx
118 
119 
120 #endif // end file guard