Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:52:45

0001 // Copyright (C) 2001-2003
0002 // Mac Murrett
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See
0005 // accompanying file LICENSE_1_0.txt or copy at
0006 // http://www.boost.org/LICENSE_1_0.txt)
0007 //
0008 // See http://www.boost.org for most recent version including documentation.
0009 
0010 #ifndef BOOST_FORCE_CAST_MJM012402_HPP
0011 #define BOOST_FORCE_CAST_MJM012402_HPP
0012 
0013 #include <boost/thread/detail/config.hpp>
0014 
0015 namespace boost {
0016 namespace detail {
0017 namespace thread {
0018 
0019 // force_cast will convert anything to anything.
0020 
0021 // general case
0022 template<class Return_Type, class Argument_Type>
0023 inline Return_Type &force_cast(Argument_Type &rSrc)
0024 {
0025     return(*reinterpret_cast<Return_Type *>(&rSrc));
0026 }
0027 
0028 // specialization for const
0029 template<class Return_Type, class Argument_Type>
0030 inline const Return_Type &force_cast(const Argument_Type &rSrc)
0031 {
0032     return(*reinterpret_cast<const Return_Type *>(&rSrc));
0033 }
0034 
0035 } // namespace thread
0036 } // namespace detail
0037 } // namespace boost
0038 
0039 #endif // BOOST_FORCE_CAST_MJM012402_HPP