1 // Copyright (C) 2002 Brad King (brad.king@kitware.com)
2 // Douglas Gregor (gregod@cs.rpi.edu)
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)
9 // For more information, see http://www.boost.org
11 #ifndef BOOST_UTILITY_ADDRESSOF_HPP
12 # define BOOST_UTILITY_ADDRESSOF_HPP
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>
22 // Do not make addressof() inline. Breaks MSVC 7. (Peter Dimov)
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
28 template <typename T> T*
32 return reinterpret_cast<T*>(
33 &const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
38 #endif // BOOST_UTILITY_ADDRESSOF_HPP