dynamic_bitset 1.3.0
Simple Useful Libraries: C++17/20 header-only dynamic bitset
Loading...
Searching...
No Matches
dynamic_bitset.hpp File Reference

sul::dynamic_bitset declaration and implementation. More...

#include <memory>
#include <vector>
#include <algorithm>
#include <string>
#include <string_view>
#include <functional>
#include <type_traits>
#include <limits>
#include <stdexcept>
#include <cmath>
#include <cassert>

Go to the source code of this file.

Classes

class  sul::dynamic_bitset< Block, Allocator >
 Dynamic bitset. More...
 
class  sul::dynamic_bitset< Block, Allocator >::reference
 Reference to a sul::dynamic_bitset bit. More...
 

Namespaces

namespace  sul
 Simple Useful Libraries.
 

Macros

#define SUL_DYNAMIC_BITSET_VERSION_MAJOR   1
 sul::dynamic_bitset version major.
 
#define SUL_DYNAMIC_BITSET_VERSION_MINOR   3
 sul::dynamic_bitset version minor.
 
#define SUL_DYNAMIC_BITSET_VERSION_PATCH   0
 sul::dynamic_bitset version patch.
 

Functions

template<typename integral_type , typename = std::enable_if_t<std::is_integral_v<integral_type>>>
 sul::dynamic_bitset (integral_type) -> dynamic_bitset<>
 
template<typename Block , typename Allocator >
constexpr bool sul::operator!= (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs)
 Test if two sul::dynamic_bitset content are different.
 
template<typename Block , typename Allocator >
constexpr bool sul::operator<= (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs)
 Test if lhs is "less than or equal to" rhs. The comparison of the two sul::dynamic_bitset is first on numbers their content represent and then on their size.
 
template<typename Block , typename Allocator >
constexpr bool sul::operator> (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs)
 Test if lhs is "greater than" rhs. The comparison of the two sul::dynamic_bitset is first on numbers their content represent and then on their size.
 
template<typename Block , typename Allocator >
constexpr bool sul::operator>= (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs)
 Test if lhs is "greater than or equal to" rhs. The comparison of the two sul::dynamic_bitset is first on numbers their content represent and then on their size.
 
template<typename Block , typename Allocator >
constexpr dynamic_bitset< Block, Allocatorsul::operator& (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs)
 Performs binary AND on corresponding pairs of bits of lhs and rhs.
 
template<typename Block , typename Allocator >
constexpr dynamic_bitset< Block, Allocatorsul::operator| (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs)
 Performs binary OR on corresponding pairs of bits of lhs and rhs.
 
template<typename Block , typename Allocator >
constexpr dynamic_bitset< Block, Allocatorsul::operator^ (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs)
 Performs binary XOR on corresponding pairs of bits of lhs and rhs.
 
template<typename Block , typename Allocator >
constexpr dynamic_bitset< Block, Allocatorsul::operator- (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs)
 Performs binary difference between bits of lhs and rhs.
 
template<typename _CharT , typename _Traits , typename Block , typename Allocator >
constexpr std::basic_ostream< _CharT, _Traits > & sul::operator<< (std::basic_ostream< _CharT, _Traits > &os, const dynamic_bitset< Block, Allocator > &bitset)
 Insert a string representation of this sul::dynamic_bitset to a character stream.
 
template<typename _CharT , typename _Traits , typename Block , typename Allocator >
constexpr std::basic_istream< _CharT, _Traits > & sul::operator>> (std::basic_istream< _CharT, _Traits > &is, dynamic_bitset< Block, Allocator > &bitset)
 Extract a sul::dynamic_bitset from a character stream using its string representation.
 
template<typename Block , typename Allocator >
constexpr void sul::swap (dynamic_bitset< Block, Allocator > &bitset1, dynamic_bitset< Block, Allocator > &bitset2)
 Exchange the content of bitset1 and bitset2.
 
template<typename Block_ , typename Allocator_ >
constexpr bool sul::operator== (const dynamic_bitset< Block_, Allocator_ > &lhs, const dynamic_bitset< Block_, Allocator_ > &rhs)
 
template<typename Block_ , typename Allocator_ >
constexpr bool sul::operator< (const dynamic_bitset< Block_, Allocator_ > &lhs, const dynamic_bitset< Block_, Allocator_ > &rhs)
 

Detailed Description

sul::dynamic_bitset declaration and implementation.

Standalone file, does not depend on other implementation files or dependencies other than the standard library, can be taken and used directly.

Can optionally include and use libpopcnt if DYNAMIC_BITSET_NO_LIBPOPCNT is not defined and __has_include(<libpopcnt.h>) is true.

Remarks
Include multiple standard library headers and optionally libpopcnt.h.
Since
1.0.0

Macro Definition Documentation

◆ SUL_DYNAMIC_BITSET_VERSION_MAJOR

#define SUL_DYNAMIC_BITSET_VERSION_MAJOR   1

sul::dynamic_bitset version major.

Since
1.1.0

◆ SUL_DYNAMIC_BITSET_VERSION_MINOR

#define SUL_DYNAMIC_BITSET_VERSION_MINOR   3

sul::dynamic_bitset version minor.

Since
1.1.0

◆ SUL_DYNAMIC_BITSET_VERSION_PATCH

#define SUL_DYNAMIC_BITSET_VERSION_PATCH   0

sul::dynamic_bitset version patch.

Since
1.1.0