Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/boost/variant/detail/cast_storage.hpp @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.3 KB
Line 
1//-----------------------------------------------------------------------------
2// boost variant/detail/cast_storage.hpp header file
3// See http://www.boost.org for updates, documentation, and revision history.
4//-----------------------------------------------------------------------------
5//
6// Copyright (c) 2003
7// Eric Friedman
8//
9// Distributed under the Boost Software License, Version 1.0. (See
10// accompanying file LICENSE_1_0.txt or copy at
11// http://www.boost.org/LICENSE_1_0.txt)
12
13#ifndef BOOST_VARIANT_DETAIL_CAST_STORAGE_HPP
14#define BOOST_VARIANT_DETAIL_CAST_STORAGE_HPP
15
16#include "boost/config.hpp"
17
18namespace boost {
19namespace detail { namespace variant {
20
21///////////////////////////////////////////////////////////////////////////////
22// (detail) function template cast_storage
23//
24// Casts the given storage to the specified type, but with qualification.
25//
26
27template <typename T>
28inline T& cast_storage(
29      void* storage
30      BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T)
31    )
32{
33    return *static_cast<T*>(storage);
34}
35
36template <typename T>
37inline const T& cast_storage(
38      const void* storage
39      BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T)
40    )
41{
42    return *static_cast<const T*>(storage);
43}
44
45}} // namespace detail::variant
46} // namespace boost
47
48#endif // BOOST_VARIANT_DETAIL_CAST_STORAGE_HPP
Note: See TracBrowser for help on using the repository browser.