epoc32/include/stdapis/boost/utility/addressof.hpp
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/utility/addressof.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,58 @@
     1.4 +// Copyright (C) 2002 Brad King (brad.king@kitware.com) 
     1.5 +//                    Douglas Gregor (gregod@cs.rpi.edu)
     1.6 +//                    Peter Dimov
     1.7 +//
     1.8 +// Distributed under the Boost Software License, Version 1.0. (See
     1.9 +// accompanying file LICENSE_1_0.txt or copy at
    1.10 +// http://www.boost.org/LICENSE_1_0.txt)
    1.11 +
    1.12 +// For more information, see http://www.boost.org
    1.13 +
    1.14 +#ifndef BOOST_UTILITY_ADDRESSOF_HPP
    1.15 +# define BOOST_UTILITY_ADDRESSOF_HPP
    1.16 +
    1.17 +# include <boost/config.hpp>
    1.18 +# include <boost/detail/workaround.hpp>
    1.19 +
    1.20 +namespace boost {
    1.21 +
    1.22 +// Do not make addressof() inline. Breaks MSVC 7. (Peter Dimov)
    1.23 +
    1.24 +// VC7 strips const from nested classes unless we add indirection here
    1.25 +# if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
    1.26 +
    1.27 +template<class T> struct _addp
    1.28 +{
    1.29 +    typedef T * type;
    1.30 +};
    1.31 +    
    1.32 +template <typename T> typename _addp<T>::type
    1.33 +
    1.34 +# else
    1.35 +template <typename T> T*
    1.36 +# endif
    1.37 +addressof(T& v)
    1.38 +{
    1.39 +  return reinterpret_cast<T*>(
    1.40 +       &const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
    1.41 +}
    1.42 +
    1.43 +// Borland doesn't like casting an array reference to a char reference
    1.44 +// but these overloads work around the problem.
    1.45 +# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
    1.46 +template<typename T,std::size_t N>
    1.47 +T (*addressof(T (&t)[N]))[N]
    1.48 +{
    1.49 +   return reinterpret_cast<T(*)[N]>(&t);
    1.50 +}
    1.51 +
    1.52 +template<typename T,std::size_t N>
    1.53 +const T (*addressof(const T (&t)[N]))[N]
    1.54 +{
    1.55 +   return reinterpret_cast<const T(*)[N]>(&t);
    1.56 +}
    1.57 +# endif
    1.58 +
    1.59 +}
    1.60 +
    1.61 +#endif // BOOST_UTILITY_ADDRESSOF_HPP