[Boost-bugs] [Boost C++ Libraries] #11122: Bulk/Range set/unset operations

Subject: [Boost-bugs] [Boost C++ Libraries] #11122: Bulk/Range set/unset operations
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-03-18 15:20:47


#11122: Bulk/Range set/unset operations
-------------------------------------+----------------------------
 Reporter: gonzalobg88@… | Owner: jsiek
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: dynamic_bitset
  Version: Boost Development Trunk | Severity: Problem
 Keywords: |
-------------------------------------+----------------------------
 I need to set/unset a subrange of the elements within a dynamic bitset.
 The current best way (that I know of) of doing this, is assigning a value
 to each element individually.

 This is far from optimal, since an optimal solution would iterate over the
 blocks, setting the value once for each block. It is also non-trivial to
 work around this, since one needs to consider that the sub-range might
 being and end in the middle of some block.

 I propose to add the following two overloads to the set and unset member
 functions, to allow for this use case:

 std::size_t set(std::size_t from, std::size_t to, bool value);
 std::size_t unset(std::size_t from, std::size_t to, bool value);
 // (maybe range-based and iterator-based versions should be added as well)

 I'm willing to implement, test, and document this. But want to discuss
 before:

 What do you think? Is there a better solution to this problem that is both
 safe and efficient?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11122>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC