Skip to content

Header only library that adds iterator functionality to the stl bitset class

License

Notifications You must be signed in to change notification settings

benkonz/BitsetContainer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

BitsetContainer

Single header only library that adds iterator functionality to the stl bitsetPtr class. The code is written in C++14 with no dependencies. To use the code, clone the project and eiher include the include directory, or use cmake to install the project

Example

#include <BitsetContainer/BitsetContainer.hpp>
#include <algorithm>
#include <iostream>

//create a bitsetPtr with a size of 8 and a value of 01010101
BitsetContainer<8> byte(0b01010101);

//sort the bits in the byte
std::sort(byte.begin(), byte.end());

//print: 11110000
for(auto i : byte) {
  std::cout << i;
}
std::cout << std::endl; 

Installation and Testing

BitsetContainer uses CMake 3.8 as a build system and I've tested the code on gcc, clang, msvc, and mingw. All test cases are written with Google Test.

git clone https://github.com/bkonzUNOmaha/BitsetContainer.git
cd BitsetContainer && mkdir build && cd build
cmake ..
make
make test
make install

After you run make install, the library can be added to your cmake project. target_link_libraries includes the project.

find_package(BitsetContainer)
add_executable(TestProject ${SOURCE_FILES})
target_link_libraries(TestProject BitsetContainer)

Details

The header file is broken up into two classes, the BitsetIterator and the BitsetContainer. BitsetIterator is a random access iterator that defines all of the random access iterator operation overloads and uses a bool as a value type. The BitsetContainer class extends the std::bitsetPtr class and it defines the begin() and end() functions that return a BitsetIterator that points to the beggining and one element after the end of the Bitset.

License

This library uses the GNU Genreal Public Licence

About

Header only library that adds iterator functionality to the stl bitset class

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published