Questions tagged [boost-dynamic-bitset]

Boost.Dynamic_Bitset is a C++ library that is nearly identical to the std::bitset class, the difference being that the size of the dynamic_bitset (the number of bits) is specified at run-time during the construction of a dynamic_bitset object, whereas the size of a std::bitset is specified at compile-time through an integer template parameter.

Boost.Dynamic_Bitset is a C++ library that is nearly identical to the std::bitset class, the difference being that the size of the dynamic_bitset (the number of bits) is specified at run-time during the construction of a dynamic_bitset object, whereas the size of a std::bitset is specified at compile-time through an integer template parameter.

49 questions
0
votes
1 answer

How to get the actual bytes of a bitmap in C++ with either vector or Boost::dynamic_bitset?

I am developing a compressor that needs to handle bitmaps, and I wonder how to best handle it in C++. Here, a bitmap means an array of boolean values but each value is stored in a bit instead of a byte. For instance, "10010010" has 8 bits and can be…
0
votes
0 answers

Writing and Reading boost dynamic_bitset to/from file

I have searched everywhere but did not find any way to write and the read dynamic_bitset to/from file. How to make readFromFile() and writeToFile() functions for reading/writing desired bits?
0
votes
1 answer

writing/reading to/from a dynamic_bitset in a file c++

So I am converting the bit string to a vector of type int and then pushing the elements of vector in dynamic_bitset object and writing that object into file. Here is my code. #include #include #include…
0
votes
1 answer

How to logical-or two boost::dynamic_bitset objects of different size?

The API doesn't allow to apply logical operations to dynamic_bitsets of different size, while my application requires that if one of the bitsets is larger than the other, the result size is adjusted accordingly. I have to create a temporary copy to…
Kostja
  • 1,607
  • 10
  • 17
0
votes
1 answer

Converting boost::dynamic_bitset to string gives 8x size increase

I am trying to turn a boost::dynamic_bitset into a string so I can pass it to a compression function. I am able to convert it using boost::to_string but it leads to 8x more bits. When I convert back from string to boost::dynamic_bitset, it doesn't…
0
votes
0 answers

C++ change bits per block of boost::dynamic_bitset

I have one file that has a boost::dynamic_butset input. This file stores blocks in chunks of 8 bits. Then, it gets passed into a function in the file which I am allowed to edit. The problem is, I need to store the bits of this bitset into a vector…
Connor S
  • 353
  • 2
  • 12
0
votes
1 answer

Fill a vector of uint16_t using a boost::dynamic_bitset<>

I am creating a program that compresses files with Huffman compression. Originally I was using a vector of uint8_t to store bytes from the file, but the performance was horrible (2 hours to decompress a 74 MB file). I have decided to use 16 bit…
Connor S
  • 353
  • 2
  • 12
0
votes
1 answer

Fastest way to populate a boost::dynamic_bitset<> from a vector of strings

I am implementing a program that uses huffman encoding to compress a file. I am having trouble writing the bits of the compressed string to another bitset. I have a vector of bytes (8 digit integers), and a vector of strings huffCodes, which is of…
Connor S
  • 353
  • 2
  • 12
0
votes
1 answer

Insert boost::dynamic_bitset<> into boost::bimap

I am trying to insert boost::dynamic_bitset<> into boost::bimap. However, it is very slow as compared to inserting integers or strings. Minimal Example is given, the code of which is shown below // Example program #include #include…
AwaitedOne
  • 992
  • 3
  • 19
  • 42
0
votes
1 answer

Use of dynamic bitset to convert decimal numbers

I am solving a leetcode problem, which the output need to be a binary number without abundant digits. I have the decimal number and I was trying to use bitset to do the conversion. I wrote a function to return the number of digit given the number…
Wenzhen
  • 1
  • 4
0
votes
0 answers

dynamic_bitset boost for large dataset

I am writing a very big data to file, it is the result of the Huffman encoding which I need to save to a file and read it later. I came across the idea of using dynamic_bitset for handling the bits. I have tested my code on small data and it works…
user3178756
  • 555
  • 1
  • 5
  • 17
0
votes
1 answer

convert dynamic_bitset to std::bitset

I have an application where I need to dynamically allocate a bitset at runtime, so I'm forced to use boost::dynamic_bitset. However, for efficiency reasons, I'd like to ultimately use the data as std::bitset. How might I go about converting from…
audiFanatic
  • 2,296
  • 8
  • 40
  • 56
0
votes
0 answers

Implementation of count() in Boost's dynamic_bitset

I'm profiling some code which uses a dynamic_bitset<> and I've found my bottleneck occurs in the count() function, which needs to be called millions of times in a for loop. To be brief, the for loop takes pairs of bitsets, calculates the set…
0
votes
0 answers

How to write non-const getter functions for classes with proxy reference?

In particular I am trying to create some wrapper functions around boost::dynamic_bitset. There is a similar question, Overloading subscript operator for non-array elements although I'm hoping for a more compact solution without creating additional…
MatrixAndrew
  • 265
  • 3
  • 13
0
votes
2 answers

dynamic bitset initialized and called from other method gives segmentation fault

I initialize a dynamic bitset in a constructor of a class and then call a method of that class to fill it with some values. I get a segmentation fault no matter which part of the bitset I try to access. MyClass::MyClass() { …
jano
  • 3
  • 3