Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/intrusive/detail/size_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_SIZE_HOLDER_HPP
0014 #define BOOST_INTRUSIVE_DETAIL_SIZE_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 
0026 namespace boost {
0027 namespace intrusive {
0028 namespace detail {
0029 
0030 template<bool ConstantSize, class SizeType, class Tag = void>
0031 struct size_holder
0032 {
0033    static const bool constant_time_size = ConstantSize;
0034    typedef SizeType  size_type;
0035 
0036    inline SizeType get_size() const
0037    {  return size_;  }
0038 
0039    inline void set_size(SizeType size)
0040    {  size_ = size; }
0041 
0042    inline void decrement()
0043    {  --size_; }
0044 
0045    inline void increment()
0046    {  ++size_; }
0047 
0048    inline void increase(SizeType n)
0049    {  size_ += n; }
0050 
0051    inline void decrease(SizeType n)
0052    {  size_ -= n; }
0053 
0054    inline void swap(size_holder &other)
0055    {  SizeType tmp(size_); size_ = other.size_; other.size_ = tmp; }
0056 
0057    SizeType size_;
0058 };
0059 
0060 template<class SizeType, class Tag>
0061 struct size_holder<false, SizeType, Tag>
0062 {
0063    static const bool constant_time_size = false;
0064    typedef SizeType  size_type;
0065 
0066    inline size_type get_size() const
0067    {  return 0;  }
0068 
0069    inline void set_size(size_type)
0070    {}
0071 
0072    inline void decrement()
0073    {}
0074 
0075    inline void increment()
0076    {}
0077 
0078    inline void increase(SizeType)
0079    {}
0080 
0081    inline void decrease(SizeType)
0082    {}
0083 
0084    inline void swap(size_holder){}
0085 };
0086 
0087 }  //namespace detail{
0088 }  //namespace intrusive{
0089 }  //namespace boost{
0090 
0091 #endif //BOOST_INTRUSIVE_DETAIL_SIZE_HOLDER_HPP