diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2015-04-08 03:09:47 +0000 |
---|---|---|
committer | <> | 2015-05-05 14:37:32 +0000 |
commit | f2541bb90af059680aa7036f315f052175999355 (patch) | |
tree | a5b214744b256f07e1dc2bd7273035a7808c659f /libs/dynamic_bitset | |
parent | ed232fdd34968697a68783b3195b1da4226915b5 (diff) | |
download | boost-tarball-master.tar.gz |
Imported from /home/lorry/working-area/delta_boost-tarball/boost_1_58_0.tar.bz2.HEADboost_1_58_0master
Diffstat (limited to 'libs/dynamic_bitset')
-rw-r--r-- | libs/dynamic_bitset/bitset_test.hpp | 15 | ||||
-rw-r--r-- | libs/dynamic_bitset/dyn_bitset_unit_tests1.cpp | 20 | ||||
-rw-r--r-- | libs/dynamic_bitset/dynamic_bitset.html | 12 | ||||
-rw-r--r-- | libs/dynamic_bitset/meta/libraries.json | 16 |
4 files changed, 62 insertions, 1 deletions
diff --git a/libs/dynamic_bitset/bitset_test.hpp b/libs/dynamic_bitset/bitset_test.hpp index ac47c04a6..463033a00 100644 --- a/libs/dynamic_bitset/bitset_test.hpp +++ b/libs/dynamic_bitset/bitset_test.hpp @@ -2,6 +2,7 @@ // Copyright (c) 2001 Jeremy Siek // Copyright (c) 2003-2006, 2008 Gennaro Prota // Copyright (c) 2014 Ahmed Charles +// Copyright (c) 2014 Riccardo Marcangelo // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -367,6 +368,20 @@ struct bitset_test { BOOST_CHECK(b.size() == 0); } + static void pop_back(const Bitset& lhs) + { + Bitset b(lhs); + b.pop_back(); + BOOST_CHECK(b.size() == lhs.size() - 1); + for (std::size_t i = 0; i < b.size(); ++i) + BOOST_CHECK(b[i] == lhs[i]); + + b.pop_back(); + BOOST_CHECK(b.size() == lhs.size() - 2); + for (std::size_t j = 0; j < b.size(); ++j) + BOOST_CHECK(b[j] == lhs[j]); + } + static void append_bit(const Bitset& lhs) { Bitset b(lhs); diff --git a/libs/dynamic_bitset/dyn_bitset_unit_tests1.cpp b/libs/dynamic_bitset/dyn_bitset_unit_tests1.cpp index 31299d1ee..51b2ef942 100644 --- a/libs/dynamic_bitset/dyn_bitset_unit_tests1.cpp +++ b/libs/dynamic_bitset/dyn_bitset_unit_tests1.cpp @@ -2,6 +2,7 @@ // Copyright (c) 2001 Jeremy Siek // Copyright (c) 2003-2006 Gennaro Prota // Copyright (c) 2014 Ahmed Charles +// Copyright (c) 2014 Riccardo Marcangelo // // Copyright (c) 2014 Glen Joseph Fernandes // glenfe at live dot com @@ -379,6 +380,25 @@ void run_test_cases( BOOST_EXPLICIT_TEMPLATE_TYPE(Block) ) Tests::clear(a); } //===================================================================== + // Test pop back + { + boost::dynamic_bitset<Block> a(std::string("01")); + Tests::pop_back(a); + } + { + boost::dynamic_bitset<Block> a(std::string("10")); + Tests::pop_back(a); + } + { + const int size_to_fill_all_blocks = 4 * bits_per_block; + boost::dynamic_bitset<Block> a(size_to_fill_all_blocks, 255ul); + Tests::pop_back(a); + } + { + boost::dynamic_bitset<Block> a(long_string); + Tests::pop_back(a); + } + //===================================================================== // Test append bit { boost::dynamic_bitset<Block> a; diff --git a/libs/dynamic_bitset/dynamic_bitset.html b/libs/dynamic_bitset/dynamic_bitset.html index d03a5025d..1039115fd 100644 --- a/libs/dynamic_bitset/dynamic_bitset.html +++ b/libs/dynamic_bitset/dynamic_bitset.html @@ -180,6 +180,7 @@ public: void <a href= "#resize">resize</a>(size_type num_bits, bool value = false); void <a href="#clear">clear</a>(); + void <a href="#pop_back">pop_back</a>(); void <a href="#push_back">push_back</a>(bool bit); void <a href="#append1">append</a>(Block block); @@ -365,7 +366,7 @@ were chosen for this reason.</p> <p><tt>dynamic_bitset</tt> does not throw exceptions when a precondition is violated (as is done in <tt>std::bitset</tt>). Instead <tt>assert</tt> is used. See the guidelines for <a href= -"http://www.boost.org/more/error_handling.html">Error and Exception Handling</a> +"http://www.boost.org/community/error_handling.html">Error and Exception Handling</a> for the explanation.</p> <h3><a id="header-files">Header Files</a></h3> @@ -836,6 +837,15 @@ void <a id="clear">clear</a>() <hr /> <pre> +void <a id="pop_back">pop_back</a>(); +</pre> + +<b>Precondition:</b> <tt>!this->empty()</tt>.<br /> +<b>Effects:</b> Decreases the size of the bitset by one.<br /> + <b>Throws:</b> nothing. + +<hr /> +<pre> void <a id="push_back">push_back</a>(bool value); </pre> diff --git a/libs/dynamic_bitset/meta/libraries.json b/libs/dynamic_bitset/meta/libraries.json new file mode 100644 index 000000000..2b872e2e6 --- /dev/null +++ b/libs/dynamic_bitset/meta/libraries.json @@ -0,0 +1,16 @@ +{ + "key": "dynamic_bitset", + "name": "Dynamic Bitset", + "authors": [ + "Jeremy Siek", + "Chuck Allison" + ], + "description": "The dynamic_bitset class represents a set of bits. It provides accesses to the value of individual bits via an operator[] and provides all of the bitwise operators that one can apply to builtin integers, such as operator& and operator<<. The number of bits in the set is specified at runtime via a parameter to the constructor of the dynamic_bitset.", + "documentation": "dynamic_bitset.html", + "category": [ + "Containers" + ], + "maintainers": [ + "Jeremy Siek <jeremy.siek -at- gmail.com>" + ] +} |