]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // cast_ptr.hpp --------------------------------------------------------------// |
2 | ||
3 | // Copyright 2015 Andrey Semashev | |
4 | ||
5 | // Distributed under the Boost Software License, Version 1.0. | |
6 | // See http://www.boost.org/LICENSE_1_0.txt | |
7 | ||
8 | ||
9 | #ifndef BOOST_DETAIL_WINAPI_DETAIL_CAST_PTR_HPP | |
10 | #define BOOST_DETAIL_WINAPI_DETAIL_CAST_PTR_HPP | |
11 | ||
12 | #include <boost/detail/winapi/config.hpp> | |
13 | ||
14 | #ifdef BOOST_HAS_PRAGMA_ONCE | |
15 | #pragma once | |
16 | #endif | |
17 | ||
18 | namespace boost { | |
19 | namespace detail { | |
20 | namespace winapi { | |
21 | namespace detail { | |
22 | ||
23 | //! This class is used to automatically cast pointers to the type used in the current Windows SDK function declarations | |
24 | class cast_ptr | |
25 | { | |
26 | private: | |
27 | const void* m_p; | |
28 | ||
29 | public: | |
30 | explicit BOOST_FORCEINLINE cast_ptr(const void* p) BOOST_NOEXCEPT : m_p(p) {} | |
31 | template< typename T > | |
32 | BOOST_FORCEINLINE operator T* () const BOOST_NOEXCEPT { return (T*)m_p; } | |
33 | }; | |
34 | ||
35 | } | |
36 | } | |
37 | } | |
38 | } | |
39 | ||
40 | #endif // BOOST_DETAIL_WINAPI_DETAIL_CAST_PTR_HPP |