Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:44:18

0001 /////////////////////////////////////////////////////////////////////////////
0002 //
0003 // (C) Copyright Ion Gaztanaga  2006-2013
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_DERIVATION_VALUE_TRAITS_HPP
0014 #define BOOST_INTRUSIVE_DERIVATION_VALUE_TRAITS_HPP
0015 
0016 #include <boost/intrusive/detail/config_begin.hpp>
0017 #include <boost/intrusive/intrusive_fwd.hpp>
0018 #include <boost/intrusive/link_mode.hpp>
0019 #include <boost/intrusive/pointer_traits.hpp>
0020 
0021 #if defined(BOOST_HAS_PRAGMA_ONCE)
0022 #  pragma once
0023 #endif
0024 
0025 namespace boost {
0026 namespace intrusive {
0027 
0028 //!This value traits template is used to create value traits
0029 //!from user defined node traits where value_traits::value_type will
0030 //!derive from node_traits::node
0031 
0032 template<class T, class NodeTraits, link_mode_type LinkMode
0033    #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0034    = safe_link
0035    #endif
0036 >
0037 struct derivation_value_traits
0038 {
0039    public:
0040    typedef NodeTraits                                                node_traits;
0041    typedef T                                                         value_type;
0042    typedef typename node_traits::node                                node;
0043    typedef typename node_traits::node_ptr                            node_ptr;
0044    typedef typename node_traits::const_node_ptr                      const_node_ptr;
0045    typedef typename pointer_traits<node_ptr>::
0046       template rebind_pointer<value_type>::type                      pointer;
0047    typedef typename pointer_traits<node_ptr>::
0048       template rebind_pointer<const value_type>::type                const_pointer;
0049    typedef typename boost::intrusive::
0050       pointer_traits<pointer>::reference                             reference;
0051    typedef typename boost::intrusive::
0052       pointer_traits<const_pointer>::reference                       const_reference;
0053    static const link_mode_type link_mode = LinkMode;
0054 
0055    BOOST_INTRUSIVE_FORCEINLINE static node_ptr to_node_ptr(reference value) BOOST_NOEXCEPT
0056    { return node_ptr(&value); }
0057 
0058    BOOST_INTRUSIVE_FORCEINLINE static const_node_ptr to_node_ptr(const_reference value) BOOST_NOEXCEPT
0059    { return node_ptr(&value); }
0060 
0061    BOOST_INTRUSIVE_FORCEINLINE static pointer to_value_ptr(node_ptr n) BOOST_NOEXCEPT
0062    {
0063       return pointer_traits<pointer>::pointer_to(static_cast<reference>(*n));
0064    }
0065 
0066    BOOST_INTRUSIVE_FORCEINLINE static const_pointer to_value_ptr(const_node_ptr n) BOOST_NOEXCEPT
0067    {
0068       return pointer_traits<const_pointer>::pointer_to(static_cast<const_reference>(*n));
0069    }
0070 };
0071 
0072 } //namespace intrusive
0073 } //namespace boost
0074 
0075 #include <boost/intrusive/detail/config_end.hpp>
0076 
0077 #endif //BOOST_INTRUSIVE_DERIVATION_VALUE_TRAITS_HPP