]> git.cworth.org Git - vogl/blob - src/extlib/loki/include/loki/ConstPolicy.h
Initial vogl checkin
[vogl] / src / extlib / loki / include / loki / ConstPolicy.h
1 ////////////////////////////////////////////////////////////////////////////////
2 // The Loki Library
3 // Copyright (c) 2006 Richard Sposato
4 // Copyright (c) 2006 Peter Kümmel
5 // Permission to use, copy, modify, distribute and sell this software for any
6 //     purpose is hereby granted without fee, provided that the above copyright
7 //     notice appear in all copies and that both that copyright notice and this
8 //     permission notice appear in supporting documentation.
9 // The authors make no representations about the
10 //     suitability of this software for any purpose. It is provided "as is"
11 //     without express or implied warranty.
12 ////////////////////////////////////////////////////////////////////////////////
13 #ifndef LOKI_CONST_POLICY_INC_
14 #define LOKI_CONST_POLICY_INC_
15
16 // $Id: ConstPolicy.h 769 2006-10-26 10:58:19Z syntheticpp $
17
18
19 namespace Loki
20 {
21
22 ////////////////////////////////////////////////////////////////////////////////
23 /// @note These policy classes are used in LockingPtr and SmartPtr to define
24 ///  how const is propagated from the pointee.
25 ////////////////////////////////////////////////////////////////////////////////
26
27
28 ////////////////////////////////////////////////////////////////////////////////
29 ///  \class DontPropagateConst
30 ///
31 ///  \ingroup ConstGroup
32 ///  Don't propagate constness of pointed or referred object.
33 ////////////////////////////////////////////////////////////////////////////////
34
35 template< class T >
36 struct DontPropagateConst
37 {
38         typedef T Type;
39 };
40
41 ////////////////////////////////////////////////////////////////////////////////
42 ///  \class PropagateConst
43 ///
44 ///  \ingroup ConstGroup
45 ///  Propagate constness of pointed or referred object.
46 ////////////////////////////////////////////////////////////////////////////////
47
48 template< class T >
49 struct PropagateConst
50 {
51         typedef const T Type;
52 };
53
54 // default will not break existing code
55 #ifndef LOKI_DEFAULT_CONSTNESS
56 #define LOKI_DEFAULT_CONSTNESS ::Loki::DontPropagateConst
57 #endif
58
59 } // end namespace Loki
60
61 #endif // end file guardian