Boost C++ Libraries: Ticket #11122: Bulk/Range set/unset operations https://svn.boost.org/trac10/ticket/11122 <p> 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. </p> <p> 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. </p> <p> I propose to add the following two overloads to the set and unset member functions, to allow for this use case: </p> <p> 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); <em> (maybe range-based and iterator-based versions should be added as well) </em></p> <p> I'm willing to implement, test, and document this. But want to discuss before: </p> <p> What do you think? Is there a better solution to this problem that is both safe and efficient? </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11122 Trac 1.4.3 gonzalobg88@… Wed, 18 Mar 2015 15:25:44 GMT <link>https://svn.boost.org/trac10/ticket/11122#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11122#comment:1</guid> <description> <p> Sorry, I missed a last edit. Having set and unset overloads both taking a value parameter makes no sense at all. </p> <p> I propose to add the following overload (just one) to the set member function to allow for this use case: </p> <p> std::size_t set(std::size_t from, std::size_t to, bool value = true); </p> <p> For interface symmetry one should consider set(from, to), reset(from, to), as well as iterator based, and range based versions, but I am not proposing these right now. </p> </description> <category>Ticket</category> </item> </channel> </rss>