]> git.lyx.org Git - lyx.git/blob - boost/boost/utility/addressof.hpp
major boost update
[lyx.git] / boost / boost / utility / addressof.hpp
1 // Copyright (C) 2002 Brad King (brad.king@kitware.com) 
2 //                    Doug Gregor (gregod@cs.rpi.edu)
3 //                    Peter Dimov
4 //
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.
10 //
11 // This software is provided "as is" without express or implied warranty,
12 // and with no claim as to its suitability for any purpose.
13
14 // For more information, see http://www.boost.org
15
16 #ifndef BOOST_UTILITY_ADDRESSOF_HPP
17 #define BOOST_UTILITY_ADDRESSOF_HPP
18
19 namespace boost {
20
21 // Do not make addressof() inline. Breaks MSVC 7. (Peter Dimov)
22
23 template <typename T> T* addressof(T& v)
24 {
25   return reinterpret_cast<T*>(
26        &const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
27 }
28
29 }
30
31 #endif // BOOST_UTILITY_ADDRESSOF_HPP