annotate DEPENDENCIES/generic/include/boost/thread/detail/force_cast.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Copyright (C) 2001-2003
Chris@16 2 // Mac Murrett
Chris@16 3 //
Chris@16 4 // Distributed under the Boost Software License, Version 1.0. (See
Chris@16 5 // accompanying file LICENSE_1_0.txt or copy at
Chris@16 6 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 7 //
Chris@16 8 // See http://www.boost.org for most recent version including documentation.
Chris@16 9
Chris@16 10 #ifndef BOOST_FORCE_CAST_MJM012402_HPP
Chris@16 11 #define BOOST_FORCE_CAST_MJM012402_HPP
Chris@16 12
Chris@16 13 #include <boost/thread/detail/config.hpp>
Chris@16 14
Chris@16 15 namespace boost {
Chris@16 16 namespace detail {
Chris@16 17 namespace thread {
Chris@16 18
Chris@16 19 // force_cast will convert anything to anything.
Chris@16 20
Chris@16 21 // general case
Chris@16 22 template<class Return_Type, class Argument_Type>
Chris@16 23 inline Return_Type &force_cast(Argument_Type &rSrc)
Chris@16 24 {
Chris@16 25 return(*reinterpret_cast<Return_Type *>(&rSrc));
Chris@16 26 }
Chris@16 27
Chris@16 28 // specialization for const
Chris@16 29 template<class Return_Type, class Argument_Type>
Chris@16 30 inline const Return_Type &force_cast(const Argument_Type &rSrc)
Chris@16 31 {
Chris@16 32 return(*reinterpret_cast<const Return_Type *>(&rSrc));
Chris@16 33 }
Chris@16 34
Chris@16 35 } // namespace thread
Chris@16 36 } // namespace detail
Chris@16 37 } // namespace boost
Chris@16 38
Chris@16 39 #endif // BOOST_FORCE_CAST_MJM012402_HPP