Brian Silverman | fad8f55 | 2018-08-04 23:36:19 -0700 | [diff] [blame^] | 1 | ////////////////////////////////////////////////////////////////////////////// |
| 2 | // |
| 3 | // (C) Copyright Ion Gaztanaga 2014-2015. Distributed under the Boost |
| 4 | // Software License, Version 1.0. (See accompanying file |
| 5 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 6 | // |
| 7 | // See http://www.boost.org/libs/container for documentation. |
| 8 | // |
| 9 | ////////////////////////////////////////////////////////////////////////////// |
| 10 | #ifndef BOOST_CONTAINER_DETAIL_ADDRESSOF_HPP |
| 11 | #define BOOST_CONTAINER_DETAIL_ADDRESSOF_HPP |
| 12 | |
| 13 | #ifndef BOOST_CONFIG_HPP |
| 14 | # include <boost/config.hpp> |
| 15 | #endif |
| 16 | |
| 17 | #if defined(BOOST_HAS_PRAGMA_ONCE) |
| 18 | # pragma once |
| 19 | #endif |
| 20 | |
| 21 | #include <cstddef> |
| 22 | |
| 23 | namespace boost { |
| 24 | namespace container { |
| 25 | namespace dtl { |
| 26 | |
| 27 | template <typename T> |
| 28 | BOOST_CONTAINER_FORCEINLINE T* addressof(T& obj) |
| 29 | { |
| 30 | return static_cast<T*>( |
| 31 | static_cast<void*>( |
| 32 | const_cast<char*>( |
| 33 | &reinterpret_cast<const volatile char&>(obj) |
| 34 | ))); |
| 35 | } |
| 36 | |
| 37 | } //namespace dtl { |
| 38 | } //namespace container { |
| 39 | } //namespace boost { |
| 40 | |
| 41 | #endif //#ifndef BOOST_CONTAINER_DETAIL_ADDRESSOF_HPP |