source: NonGTP/Boost/boost/python/detail/void_ptr.hpp @ 857

Revision 857, 1013 bytes checked in by igarcia, 19 years ago (diff)
RevLine 
[857]1// Copyright David Abrahams 2002.
2// Distributed under the Boost Software License, Version 1.0. (See
3// accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
5#ifndef VOID_PTR_DWA200239_HPP
6# define VOID_PTR_DWA200239_HPP
7
8# include <boost/type_traits/remove_cv.hpp>
9
10namespace boost { namespace python { namespace detail {
11
12template <class U>
13inline U& void_ptr_to_reference(void const volatile* p, U&(*)())
14{
15    return *(U*)p;
16}
17
18template <class T>
19inline void write_void_ptr(void const volatile* storage, void* ptr, T*)
20{
21    *(T**)storage = (T*)ptr;
22}
23
24// writes U(ptr) into the storage
25template <class U>
26inline void write_void_ptr_reference(void const volatile* storage, void* ptr, U&(*)())
27{
28    // stripping CV qualification suppresses warnings on older EDGs
29    typedef typename remove_cv<U>::type u_stripped;
30    write_void_ptr(storage, ptr, u_stripped(0));
31}
32
33}}} // namespace boost::python::detail
34
35#endif // VOID_PTR_DWA200239_HPP
Note: See TracBrowser for help on using the repository browser.