sl@0
|
1 |
//////////////////////////////////////////////////////////////////////////////
|
sl@0
|
2 |
//
|
sl@0
|
3 |
// (C) Copyright Ion Gaztaņaga 2005.
|
sl@0
|
4 |
// Distributed under the Boost Software License, Version 1.0.
|
sl@0
|
5 |
// (See accompanying file LICENSE_1_0.txt or copy at
|
sl@0
|
6 |
// http://www.boost.org/LICENSE_1_0.txt)
|
sl@0
|
7 |
//
|
sl@0
|
8 |
//////////////////////////////////////////////////////////////////////////////
|
sl@0
|
9 |
|
sl@0
|
10 |
#ifndef BOOST_POINTER_CAST_HPP
|
sl@0
|
11 |
#define BOOST_POINTER_CAST_HPP
|
sl@0
|
12 |
|
sl@0
|
13 |
namespace boost {
|
sl@0
|
14 |
|
sl@0
|
15 |
//static_pointer_cast overload for raw pointers
|
sl@0
|
16 |
template<class T, class U>
|
sl@0
|
17 |
inline T* static_pointer_cast(U *ptr)
|
sl@0
|
18 |
{
|
sl@0
|
19 |
return static_cast<T*>(ptr);
|
sl@0
|
20 |
}
|
sl@0
|
21 |
|
sl@0
|
22 |
//dynamic_pointer_cast overload for raw pointers
|
sl@0
|
23 |
template<class T, class U>
|
sl@0
|
24 |
inline T* dynamic_pointer_cast(U *ptr)
|
sl@0
|
25 |
{
|
sl@0
|
26 |
return dynamic_cast<T*>(ptr);
|
sl@0
|
27 |
}
|
sl@0
|
28 |
|
sl@0
|
29 |
//const_pointer_cast overload for raw pointers
|
sl@0
|
30 |
template<class T, class U>
|
sl@0
|
31 |
inline T* const_pointer_cast(U *ptr)
|
sl@0
|
32 |
{
|
sl@0
|
33 |
return const_cast<T*>(ptr);
|
sl@0
|
34 |
}
|
sl@0
|
35 |
|
sl@0
|
36 |
//reinterpret_pointer_cast overload for raw pointers
|
sl@0
|
37 |
template<class T, class U>
|
sl@0
|
38 |
inline T* reinterpret_pointer_cast(U *ptr)
|
sl@0
|
39 |
{
|
sl@0
|
40 |
return reinterpret_cast<T*>(ptr);
|
sl@0
|
41 |
}
|
sl@0
|
42 |
|
sl@0
|
43 |
} // namespace boost
|
sl@0
|
44 |
|
sl@0
|
45 |
#endif //BOOST_POINTER_CAST_HPP
|