ossrv_pub/boost_apis/boost/pointer_cast.hpp
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 //////////////////////////////////////////////////////////////////////////////
       
     2 //
       
     3 // (C) Copyright Ion Gaztaņaga 2005. 
       
     4 // Distributed under the Boost Software License, Version 1.0. 
       
     5 // (See accompanying file LICENSE_1_0.txt or copy at 
       
     6 //  http://www.boost.org/LICENSE_1_0.txt)
       
     7 //
       
     8 //////////////////////////////////////////////////////////////////////////////
       
     9 
       
    10 #ifndef BOOST_POINTER_CAST_HPP
       
    11 #define BOOST_POINTER_CAST_HPP
       
    12 
       
    13 namespace boost { 
       
    14 
       
    15 //static_pointer_cast overload for raw pointers
       
    16 template<class T, class U>
       
    17 inline T* static_pointer_cast(U *ptr)
       
    18 {  
       
    19    return static_cast<T*>(ptr);
       
    20 }
       
    21 
       
    22 //dynamic_pointer_cast overload for raw pointers
       
    23 template<class T, class U>
       
    24 inline T* dynamic_pointer_cast(U *ptr)
       
    25 {  
       
    26    return dynamic_cast<T*>(ptr);
       
    27 }
       
    28 
       
    29 //const_pointer_cast overload for raw pointers
       
    30 template<class T, class U>
       
    31 inline T* const_pointer_cast(U *ptr)
       
    32 {  
       
    33    return const_cast<T*>(ptr);
       
    34 }
       
    35 
       
    36 //reinterpret_pointer_cast overload for raw pointers
       
    37 template<class T, class U>
       
    38 inline T* reinterpret_pointer_cast(U *ptr)
       
    39 {  
       
    40    return reinterpret_cast<T*>(ptr);
       
    41 }
       
    42 
       
    43 } // namespace boost
       
    44 
       
    45 #endif   //BOOST_POINTER_CAST_HPP