summaryrefslogtreecommitdiffstats
path: root/contrib/src/boost/dynamic_bitset/dynamic_bitset.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/src/boost/dynamic_bitset/dynamic_bitset.hpp')
-rw-r--r--contrib/src/boost/dynamic_bitset/dynamic_bitset.hpp32
1 files changed, 28 insertions, 4 deletions
diff --git a/contrib/src/boost/dynamic_bitset/dynamic_bitset.hpp b/contrib/src/boost/dynamic_bitset/dynamic_bitset.hpp
index f6002d8..86b5428 100644
--- a/contrib/src/boost/dynamic_bitset/dynamic_bitset.hpp
+++ b/contrib/src/boost/dynamic_bitset/dynamic_bitset.hpp
@@ -305,6 +305,9 @@ public:
size_type num_blocks() const BOOST_NOEXCEPT;
size_type max_size() const BOOST_NOEXCEPT;
bool empty() const BOOST_NOEXCEPT;
+ size_type capacity() const BOOST_NOEXCEPT;
+ void reserve(size_type num_bits);
+ void shrink_to_fit();
bool is_subset_of(const dynamic_bitset& a) const;
bool is_proper_subset_of(const dynamic_bitset& a) const;
@@ -750,15 +753,15 @@ push_back(bool bit)
template <typename Block, typename Allocator>
void dynamic_bitset<Block, Allocator>::
-pop_back()
+pop_back()
{
const size_type old_num_blocks = num_blocks();
const size_type required_blocks = calc_num_blocks(m_num_bits - 1);
-
+
if (required_blocks != old_num_blocks) {
- m_bits.pop_back();
+ m_bits.pop_back();
}
-
+
--m_num_bits;
m_zero_unused_bits();
}
@@ -1268,6 +1271,27 @@ inline bool dynamic_bitset<Block, Allocator>::empty() const BOOST_NOEXCEPT
}
template <typename Block, typename Allocator>
+inline typename dynamic_bitset<Block, Allocator>::size_type
+dynamic_bitset<Block, Allocator>::capacity() const BOOST_NOEXCEPT
+{
+ return m_bits.capacity() * bits_per_block;
+}
+
+template <typename Block, typename Allocator>
+inline void dynamic_bitset<Block, Allocator>::reserve(size_type num_bits)
+{
+ m_bits.reserve(calc_num_blocks(num_bits));
+}
+
+template <typename Block, typename Allocator>
+void dynamic_bitset<Block, Allocator>::shrink_to_fit()
+{
+ if (m_bits.size() < m_bits.capacity()) {
+ buffer_type(m_bits).swap(m_bits);
+ }
+}
+
+template <typename Block, typename Allocator>
bool dynamic_bitset<Block, Allocator>::
is_subset_of(const dynamic_bitset<Block, Allocator>& a) const
{