epoc32/include/stdapis/boost/variant/detail/cast_storage.hpp
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
//-----------------------------------------------------------------------------
williamr@2
     2
// boost variant/detail/cast_storage.hpp header file
williamr@2
     3
// See http://www.boost.org for updates, documentation, and revision history.
williamr@2
     4
//-----------------------------------------------------------------------------
williamr@2
     5
//
williamr@2
     6
// Copyright (c) 2003
williamr@2
     7
// Eric Friedman
williamr@2
     8
//
williamr@2
     9
// Distributed under the Boost Software License, Version 1.0. (See
williamr@2
    10
// accompanying file LICENSE_1_0.txt or copy at
williamr@2
    11
// http://www.boost.org/LICENSE_1_0.txt)
williamr@2
    12
williamr@2
    13
#ifndef BOOST_VARIANT_DETAIL_CAST_STORAGE_HPP
williamr@2
    14
#define BOOST_VARIANT_DETAIL_CAST_STORAGE_HPP
williamr@2
    15
williamr@2
    16
#include "boost/config.hpp"
williamr@2
    17
williamr@2
    18
namespace boost {
williamr@2
    19
namespace detail { namespace variant {
williamr@2
    20
williamr@2
    21
///////////////////////////////////////////////////////////////////////////////
williamr@2
    22
// (detail) function template cast_storage
williamr@2
    23
//
williamr@2
    24
// Casts the given storage to the specified type, but with qualification.
williamr@2
    25
//
williamr@2
    26
williamr@2
    27
template <typename T>
williamr@2
    28
inline T& cast_storage(
williamr@2
    29
      void* storage
williamr@2
    30
      BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T)
williamr@2
    31
    )
williamr@2
    32
{
williamr@2
    33
    return *static_cast<T*>(storage);
williamr@2
    34
}
williamr@2
    35
williamr@2
    36
template <typename T>
williamr@2
    37
inline const T& cast_storage(
williamr@2
    38
      const void* storage
williamr@2
    39
      BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T)
williamr@2
    40
    )
williamr@2
    41
{
williamr@2
    42
    return *static_cast<const T*>(storage);
williamr@2
    43
}
williamr@2
    44
williamr@2
    45
}} // namespace detail::variant
williamr@2
    46
} // namespace boost
williamr@2
    47
williamr@2
    48
#endif // BOOST_VARIANT_DETAIL_CAST_STORAGE_HPP