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