1.1 --- a/epoc32/include/stdapis/boost/aligned_storage.hpp Wed Mar 31 12:27:01 2010 +0100
1.2 +++ b/epoc32/include/stdapis/boost/aligned_storage.hpp Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -1,13 +1,170 @@
1.4 +//-----------------------------------------------------------------------------
1.5 +// boost aligned_storage.hpp header file
1.6 +// See http://www.boost.org for updates, documentation, and revision history.
1.7 +//-----------------------------------------------------------------------------
1.8 +//
1.9 +// Copyright (c) 2002-2003
1.10 +// Eric Friedman, Itay Maman
1.11 +//
1.12 +// Distributed under the Boost Software License, Version 1.0. (See
1.13 +// accompanying file LICENSE_1_0.txt or copy at
1.14 +// http://www.boost.org/LICENSE_1_0.txt)
1.15
1.16 -// Copyright (C) John Maddock 2005.
1.17 -// Use, modification and distribution are subject to the Boost Software License,
1.18 -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
1.19 -// http://www.boost.org/LICENSE_1_0.txt).
1.20 +#ifndef BOOST_ALIGNED_STORAGE_HPP
1.21 +#define BOOST_ALIGNED_STORAGE_HPP
1.22 +
1.23 +#include <cstddef> // for std::size_t
1.24 +
1.25 +#include "boost/config.hpp"
1.26 +#include "boost/detail/workaround.hpp"
1.27 +#include "boost/type_traits/alignment_of.hpp"
1.28 +#include "boost/type_traits/type_with_alignment.hpp"
1.29 +#include "boost/type_traits/is_pod.hpp"
1.30 +
1.31 +#include "boost/mpl/eval_if.hpp"
1.32 +#include "boost/mpl/identity.hpp"
1.33 +
1.34 +#include "boost/type_traits/detail/bool_trait_def.hpp"
1.35 +
1.36 +namespace boost {
1.37 +
1.38 +namespace detail { namespace aligned_storage {
1.39 +
1.40 +BOOST_STATIC_CONSTANT(
1.41 + std::size_t
1.42 + , alignment_of_max_align = ::boost::alignment_of<max_align>::value
1.43 + );
1.44 +
1.45 //
1.46 -// See http://www.boost.org/libs/type_traits for most recent version including documentation.
1.47 +// To be TR1 conforming this must be a POD type:
1.48 +//
1.49 +template <
1.50 + std::size_t size_
1.51 + , std::size_t alignment_
1.52 +>
1.53 +struct aligned_storage_imp
1.54 +{
1.55 + union data_t
1.56 + {
1.57 + char buf[size_];
1.58
1.59 -#ifndef BOOST_TT_ALIGNED_STORAGE_HPP_INCLUDED
1.60 -# define BOOST_TT_ALIGNED_STORAGE_HPP_INCLUDED
1.61 -# include <boost/aligned_storage.hpp>
1.62 -#endif // BOOST_TT_ALIGNED_STORAGE_HPP_INCLUDED
1.63 + typename mpl::eval_if_c<
1.64 + alignment_ == std::size_t(-1)
1.65 + , mpl::identity<detail::max_align>
1.66 + , type_with_alignment<alignment_>
1.67 + >::type align_;
1.68 + } data_;
1.69 +};
1.70
1.71 +}} // namespace detail::aligned_storage
1.72 +
1.73 +template <
1.74 + std::size_t size_
1.75 + , std::size_t alignment_ = std::size_t(-1)
1.76 +>
1.77 +class aligned_storage
1.78 +{
1.79 +private: // representation
1.80 +
1.81 + detail::aligned_storage::aligned_storage_imp<size_, alignment_> data_;
1.82 +
1.83 +public: // constants
1.84 +
1.85 + typedef detail::aligned_storage::aligned_storage_imp<size_, alignment_> type;
1.86 +
1.87 + BOOST_STATIC_CONSTANT(
1.88 + std::size_t
1.89 + , size = size_
1.90 + );
1.91 + BOOST_STATIC_CONSTANT(
1.92 + std::size_t
1.93 + , alignment = (
1.94 + alignment_ == std::size_t(-1)
1.95 + ? ::boost::detail::aligned_storage::alignment_of_max_align
1.96 + : alignment_
1.97 + )
1.98 + );
1.99 +
1.100 +#if defined(__GNUC__) &&\
1.101 + (__GNUC__ > 3) ||\
1.102 + (__GNUC__ == 3 && (__GNUC_MINOR__ > 2 ||\
1.103 + (__GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ >=3)))
1.104 +
1.105 +private: // noncopyable
1.106 +
1.107 + aligned_storage(const aligned_storage&);
1.108 + aligned_storage& operator=(const aligned_storage&);
1.109 +
1.110 +#else // gcc less than 3.2.3
1.111 +
1.112 +public: // _should_ be noncopyable, but GCC compiler emits error
1.113 +
1.114 + aligned_storage(const aligned_storage&);
1.115 + aligned_storage& operator=(const aligned_storage&);
1.116 +
1.117 +#endif // gcc < 3.2.3 workaround
1.118 +
1.119 +public: // structors
1.120 +
1.121 + aligned_storage()
1.122 + {
1.123 + }
1.124 +
1.125 + ~aligned_storage()
1.126 + {
1.127 + }
1.128 +
1.129 +public: // accessors
1.130 +
1.131 + void* address()
1.132 + {
1.133 + return this;
1.134 + }
1.135 +
1.136 +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
1.137 +
1.138 + const void* address() const
1.139 + {
1.140 + return this;
1.141 + }
1.142 +
1.143 +#else // MSVC6
1.144 +
1.145 + const void* address() const;
1.146 +
1.147 +#endif // MSVC6 workaround
1.148 +
1.149 +};
1.150 +
1.151 +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
1.152 +
1.153 +// MSVC6 seems not to like inline functions with const void* returns, so we
1.154 +// declare the following here:
1.155 +
1.156 +template <std::size_t S, std::size_t A>
1.157 +const void* aligned_storage<S,A>::address() const
1.158 +{
1.159 + return const_cast< aligned_storage<S,A>* >(this)->address();
1.160 +}
1.161 +
1.162 +#endif // MSVC6 workaround
1.163 +
1.164 +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
1.165 +//
1.166 +// Make sure that is_pod recognises aligned_storage<>::type
1.167 +// as a POD (Note that aligned_storage<> itself is not a POD):
1.168 +//
1.169 +template <std::size_t size_, std::size_t alignment_>
1.170 +struct is_pod<boost::detail::aligned_storage::aligned_storage_imp<size_,alignment_> >
1.171 + BOOST_TT_AUX_BOOL_C_BASE(true)
1.172 +{
1.173 + BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(true)
1.174 +};
1.175 +#endif
1.176 +
1.177 +
1.178 +} // namespace boost
1.179 +
1.180 +#include "boost/type_traits/detail/bool_trait_undef.hpp"
1.181 +
1.182 +#endif // BOOST_ALIGNED_STORAGE_HPP