Update contrib.
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>
19 // Do not make addressof() inline. Breaks MSVC 7. (Peter Dimov)
21 // VC7 strips const from nested classes unless we add indirection here
22 # if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
24 template<class T> struct _addp
29 template <typename T> typename _addp<T>::type
32 template <typename T> T*
36 return reinterpret_cast<T*>(
37 &const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
40 // Borland doesn't like casting an array reference to a char reference
41 // but these overloads work around the problem.
42 # if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
43 template<typename T,std::size_t N>
44 T (*addressof(T (&t)[N]))[N]
46 return reinterpret_cast<T(*)[N]>(&t);
49 template<typename T,std::size_t N>
50 const T (*addressof(const T (&t)[N]))[N]
52 return reinterpret_cast<const T(*)[N]>(&t);
58 #endif // BOOST_UTILITY_ADDRESSOF_HPP