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