1
// Copyright (C) 2002 Brad King (brad.king@kitware.com)
2
// Doug Gregor (gregod@cs.rpi.edu)
5
// Permission to copy, use, sell and distribute this software is granted
6
// provided this copyright notice appears in all copies.
7
// Permission to modify the code and to distribute modified code is granted
8
// provided this copyright notice appears in all copies, and a notice
9
// that the code was modified is included with the copyright notice.
11
// This software is provided "as is" without express or implied warranty,
12
// and with no claim as to its suitability for any purpose.
14
// For more information, see http://www.boost.org
16
#ifndef BOOST_UTILITY_ADDRESSOF_HPP
17
# define BOOST_UTILITY_ADDRESSOF_HPP
19
# include <boost/config.hpp>
20
# include <boost/detail/workaround.hpp>
21
# if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
22
# include <boost/type_traits/add_pointer.hpp>
27
// Do not make addressof() inline. Breaks MSVC 7. (Peter Dimov)
29
// VC7 strips const from nested classes unless we add indirection here
30
# if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
31
template <typename T> typename add_pointer<T>::type
33
template <typename T> T*
37
return reinterpret_cast<T*>(
38
&const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
43
#endif // BOOST_UTILITY_ADDRESSOF_HPP