Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:42:08

0001 /* Copyright 2003-2015 Joaquin M Lopez Munoz.
0002  * Distributed under the Boost Software License, Version 1.0.
0003  * (See accompanying file LICENSE_1_0.txt or copy at
0004  * http://www.boost.org/LICENSE_1_0.txt)
0005  *
0006  * See http://www.boost.org/libs/multi_index for library home page.
0007  */
0008 
0009 #ifndef BOOST_MULTI_INDEX_DETAIL_RAW_PTR_HPP
0010 #define BOOST_MULTI_INDEX_DETAIL_RAW_PTR_HPP
0011 
0012 #if defined(_MSC_VER)
0013 #pragma once
0014 #endif
0015 
0016 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
0017 #include <boost/mpl/bool.hpp>
0018 #include <boost/type_traits/is_same.hpp>
0019 
0020 namespace boost{
0021 
0022 namespace multi_index{
0023 
0024 namespace detail{
0025 
0026 /* gets the underlying pointer of a pointer-like value */
0027 
0028 template<typename RawPointer>
0029 inline RawPointer raw_ptr(RawPointer const& p,mpl::true_)
0030 {
0031   return p;
0032 }
0033 
0034 template<typename RawPointer,typename Pointer>
0035 inline RawPointer raw_ptr(Pointer const& p,mpl::false_)
0036 {
0037   return p==Pointer(0)?0:&*p;
0038 }
0039 
0040 template<typename RawPointer,typename Pointer>
0041 inline RawPointer raw_ptr(Pointer const& p)
0042 {
0043   return raw_ptr<RawPointer>(p,is_same<RawPointer,Pointer>());
0044 }
0045 
0046 } /* namespace multi_index::detail */
0047 
0048 } /* namespace multi_index */
0049 
0050 } /* namespace boost */
0051 
0052 #endif