]> git.lyx.org Git - lyx.git/blob - boost/boost/utility/addressof.hpp
update to boost 1.32.0
[lyx.git] / boost / boost / utility / addressof.hpp
1 // Copyright (C) 2002 Brad King (brad.king@kitware.com) 
2 //                    Douglas Gregor (gregod@cs.rpi.edu)
3 //                    Peter Dimov
4 //
5 // Distributed under the Boost Software License, Version 1.0. (See
6 // accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8
9 // For more information, see http://www.boost.org
10
11 #ifndef BOOST_UTILITY_ADDRESSOF_HPP
12 # define BOOST_UTILITY_ADDRESSOF_HPP
13
14 # include <boost/config.hpp>
15 # include <boost/detail/workaround.hpp>
16 # if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
17 #  include <boost/type_traits/add_pointer.hpp>
18 # endif
19
20 namespace boost {
21
22 // Do not make addressof() inline. Breaks MSVC 7. (Peter Dimov)
23
24 // VC7 strips const from nested classes unless we add indirection here
25 # if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
26 template <typename T> typename add_pointer<T>::type
27 # else
28 template <typename T> T*
29 # endif
30 addressof(T& v)
31 {
32   return reinterpret_cast<T*>(
33        &const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
34 }
35
36 }
37
38 #endif // BOOST_UTILITY_ADDRESSOF_HPP