~tsarev/boostdc/cmake

« back to all changes in this revision

Viewing changes to boost/boost/thread/detail/force_cast.hpp

  • Committer: bigmuscle
  • Date: 2010-05-08 08:47:15 UTC
  • Revision ID: svn-v4:5fb55d53-692c-0410-a46a-e90ab66e00ee:trunk:497
removed old boost version

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright (C) 2001-2003
2
 
// Mac Murrett
3
 
//
4
 
// Distributed under the Boost Software License, Version 1.0. (See
5
 
// accompanying file LICENSE_1_0.txt or copy at
6
 
// http://www.boost.org/LICENSE_1_0.txt)
7
 
//
8
 
// See http://www.boost.org for most recent version including documentation.
9
 
 
10
 
#ifndef BOOST_FORCE_CAST_MJM012402_HPP
11
 
#define BOOST_FORCE_CAST_MJM012402_HPP
12
 
 
13
 
#include <boost/thread/detail/config.hpp>
14
 
 
15
 
namespace boost {
16
 
namespace detail {
17
 
namespace thread {
18
 
 
19
 
// force_cast will convert anything to anything.
20
 
 
21
 
// general case
22
 
template<class Return_Type, class Argument_Type>
23
 
inline Return_Type &force_cast(Argument_Type &rSrc)
24
 
{
25
 
    return(*reinterpret_cast<Return_Type *>(&rSrc));
26
 
}
27
 
 
28
 
// specialization for const
29
 
template<class Return_Type, class Argument_Type>
30
 
inline const Return_Type &force_cast(const Argument_Type &rSrc)
31
 
{
32
 
    return(*reinterpret_cast<const Return_Type *>(&rSrc));
33
 
}
34
 
 
35
 
} // namespace thread
36
 
} // namespace detail
37
 
} // namespace boost
38
 
 
39
 
#endif // BOOST_FORCE_CAST_MJM012402_HPP