Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/intrusive/detail/default_header_holder.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /////////////////////////////////////////////////////////////////////////////
0002 //
0003 // (C) Copyright Ion Gaztanaga  2014-2014
0004 //
0005 // Distributed under the Boost Software License, Version 1.0.
0006 //    (See accompanying file LICENSE_1_0.txt or copy at
0007 //          http://www.boost.org/LICENSE_1_0.txt)
0008 //
0009 // See http://www.boost.org/libs/intrusive for documentation.
0010 //
0011 /////////////////////////////////////////////////////////////////////////////
0012 
0013 #ifndef BOOST_INTRUSIVE_DETAIL_DEFAULT_HEADER_HOLDER_HPP
0014 #define BOOST_INTRUSIVE_DETAIL_DEFAULT_HEADER_HOLDER_HPP
0015 
0016 #ifndef BOOST_CONFIG_HPP
0017 #  include <boost/config.hpp>
0018 #endif
0019 
0020 #if defined(BOOST_HAS_PRAGMA_ONCE)
0021 #  pragma once
0022 #endif
0023 
0024 #include <boost/intrusive/detail/workaround.hpp>
0025 #include <boost/intrusive/pointer_traits.hpp>
0026 #include <boost/move/detail/to_raw_pointer.hpp>
0027 
0028 namespace boost {
0029 namespace intrusive {
0030 namespace detail {
0031 
0032 // trivial header node holder
0033 template < typename NodeTraits >
0034 struct default_header_holder : public NodeTraits::node
0035 {
0036    typedef NodeTraits node_traits;
0037    typedef typename node_traits::node node;
0038    typedef typename node_traits::node_ptr node_ptr;
0039    typedef typename node_traits::const_node_ptr const_node_ptr;
0040 
0041    default_header_holder() : node() {}
0042 
0043    inline const_node_ptr get_node() const
0044    { return pointer_traits< const_node_ptr >::pointer_to(*static_cast< const node* >(this)); }
0045 
0046    inline node_ptr get_node()
0047    { return pointer_traits< node_ptr >::pointer_to(*static_cast< node* >(this)); }
0048 
0049    // (unsafe) downcast used to implement container-from-iterator
0050    inline static default_header_holder* get_holder(node_ptr p)
0051    { return static_cast< default_header_holder* >(boost::movelib::to_raw_pointer(p)); }
0052 };
0053 
0054 // type function producing the header node holder
0055 template < typename ValueTraits, typename HeaderHolder >
0056 struct get_header_holder_type
0057 {
0058    typedef HeaderHolder type;
0059 };
0060 template < typename ValueTraits >
0061 struct get_header_holder_type< ValueTraits, void >
0062 {
0063    typedef default_header_holder< typename ValueTraits::node_traits > type;
0064 };
0065 
0066 } //namespace detail
0067 } //namespace intrusive
0068 } //namespace boost
0069 
0070 #endif //BOOST_INTRUSIVE_DETAIL_DEFAULT_HEADER_HOLDER_HPP