Chris@16
|
1 #ifndef BOOST_POINTER_TO_OTHER_HPP_INCLUDED
|
Chris@16
|
2 #define BOOST_POINTER_TO_OTHER_HPP_INCLUDED
|
Chris@16
|
3
|
Chris@16
|
4 //
|
Chris@16
|
5 // pointer_to_other.hpp
|
Chris@16
|
6 //
|
Chris@16
|
7 // (C) Copyright Ion Gaztanaga 2005.
|
Chris@16
|
8 // Copyright (c) 2005 Peter Dimov.
|
Chris@16
|
9 //
|
Chris@16
|
10 // Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
11 //
|
Chris@16
|
12 // (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
13 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
14 //
|
Chris@16
|
15 // See http://www.boost.org/libs/smart_ptr/pointer_to_other.html
|
Chris@16
|
16 //
|
Chris@16
|
17
|
Chris@16
|
18 namespace boost
|
Chris@16
|
19 {
|
Chris@16
|
20
|
Chris@16
|
21 // Defines the same pointer type (raw or smart) to another pointee type
|
Chris@16
|
22
|
Chris@16
|
23 template<class T, class U>
|
Chris@16
|
24 struct pointer_to_other;
|
Chris@16
|
25
|
Chris@16
|
26 template<class T, class U,
|
Chris@16
|
27 template<class> class Sp>
|
Chris@16
|
28 struct pointer_to_other< Sp<T>, U >
|
Chris@16
|
29 {
|
Chris@16
|
30 typedef Sp<U> type;
|
Chris@16
|
31 };
|
Chris@16
|
32
|
Chris@16
|
33 template<class T, class T2, class U,
|
Chris@16
|
34 template<class, class> class Sp>
|
Chris@16
|
35 struct pointer_to_other< Sp<T, T2>, U >
|
Chris@16
|
36 {
|
Chris@16
|
37 typedef Sp<U, T2> type;
|
Chris@16
|
38 };
|
Chris@16
|
39
|
Chris@16
|
40 template<class T, class T2, class T3, class U,
|
Chris@16
|
41 template<class, class, class> class Sp>
|
Chris@16
|
42 struct pointer_to_other< Sp<T, T2, T3>, U >
|
Chris@16
|
43 {
|
Chris@16
|
44 typedef Sp<U, T2, T3> type;
|
Chris@16
|
45 };
|
Chris@16
|
46
|
Chris@16
|
47 template<class T, class U>
|
Chris@16
|
48 struct pointer_to_other< T*, U >
|
Chris@16
|
49 {
|
Chris@16
|
50 typedef U* type;
|
Chris@16
|
51 };
|
Chris@16
|
52
|
Chris@16
|
53 } // namespace boost
|
Chris@16
|
54
|
Chris@16
|
55 #endif // #ifndef BOOST_POINTER_TO_OTHER_HPP_INCLUDED
|