123#ifndef __ADS_RoaringBitmap
124 #define __ADS_RoaringBitmap
165 static constexpr std::uint32_t
ARRAY = 4096;
201 [[nodiscard]]
bool contains( std::uint32_t x )
const;
245 [[nodiscard]] std::size_t
size(
void )
const;
248 [[nodiscard]]
bool empty(
void )
const;
260 [[nodiscard]] std::size_t
bitmaps(
void )
const;
263 [[nodiscard]] std::size_t
bytes(
void )
const;
270 [[nodiscard]] std::vector< std::uint32_t >
items(
void )
const;
289 [[nodiscard]] std::size_t
rank( std::uint32_t x )
const;
313 std::size_t * used =
nullptr );
326 static constexpr std::size_t WORDS = 1024;
331 std::uint16_t key = 0;
332 std::uint32_t card = 0;
333 std::vector< std::uint16_t , detail::UninitAllocator< std::uint16_t > > a;
335 std::unique_ptr< std::uint64_t[] > w;
338 [[nodiscard]]
bool bits(
void )
const {
return( w !=
nullptr ); }
356 static Block combine(
const Block & a ,
const Block & b );
359 static Block copy(
const Block & b );
362 static void toBitmap( Block & b );
365 static void toArray( Block & b );
369 static Block fromWords( std::uint16_t key ,
370 std::unique_ptr< std::uint64_t[] > w ,
371 std::uint32_t card );
392 [[nodiscard]] std::size_t find( std::uint16_t key )
const;
395 [[nodiscard]]
bool valid(
void )
const;
400 std::vector< Block > f_B;
401 std::vector< std::uint16_t > f_K;
402 std::size_t f_size = 0;
430 f_word &= f_word - 1;
432 f_x = f_base + std::uint32_t( std::countr_zero( f_word ) );
449 return( ( f_b == o.f_b ) && ( f_i == o.f_i ) && ( f_x == o.f_x ) );
466 std::uint64_t f_word = 0;
467 std::uint32_t f_base = 0;
468 std::uint32_t f_x = 0;
626#include "ADS/set/impl/RoaringBitmap.tpp"
The SET of the integers in as a boolean vector of section 8.1: contains(), insert() and remove() in ...
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
A file mapped in memory, shared by the structures that are read from it in place [see Persistence....
The primitives of the processor that the compilers spell each in their own way, in one form for all: ...
The vector kernels of ADS on Google Highway, with ADS_WITH_HIGHWAY: the loops over arrays that a stru...
the iterator on the items in increasing order, forward
Definition RoaringBitmap.h:410
bool operator==(const const_iterator &o) const
equal on the same item of the same container
Definition RoaringBitmap.h:448
std::forward_iterator_tag iterator_concept
forward for the concepts of C++20
Definition RoaringBitmap.h:416
const_iterator(void)=default
an iterator on no set
const_iterator & operator++(void)
to the next item: the next bit of the word of a bitmap, or the next place, word or container
Definition RoaringBitmap.h:428
const_iterator operator++(int)
to the next item, returning the iterator before the step
Definition RoaringBitmap.h:441
std::ptrdiff_t difference_type
the distances
Definition RoaringBitmap.h:414
std::uint32_t reference
an item, by value
Definition RoaringBitmap.h:413
friend class RoaringBitmap
Definition RoaringBitmap.h:453
reference operator*(void) const
the item
Definition RoaringBitmap.h:424
std::uint32_t value_type
the items
Definition RoaringBitmap.h:412
std::input_iterator_tag iterator_category
input for the older algorithms, since *it is a value
Definition RoaringBitmap.h:418
a set of integers of 32 bits as a Roaring bitmap
Definition RoaringBitmap.h:158
std::vector< std::uint32_t > items(void) const
the items in increasing order
RoaringBitmap(RoaringBitmap &&o) noexcept=default
the containers of o, which is left empty
void swap(RoaringBitmap &o) noexcept
the items of this set and of o exchanged,
const_iterator lowerBound(std::uint32_t x) const
the first item not smaller than , end() if none
RoaringBitmap(void)=default
the empty set
static constexpr std::uint32_t ARRAY
the items of an array container at most
Definition RoaringBitmap.h:165
std::size_t bitmaps(void) const
the containers that are bitmaps
const_iterator iterator
the same, constant
Definition RoaringBitmap.h:477
std::size_t containers(void) const
the containers
bool contains(std::uint32_t x) const
whether is in the set
std::size_t writePortable(std::span< std::byte > out) const
the set written at the start of in the portable format of Roaring, with no container of runs; the by...
std::size_t portableSizeInBytes(void) const
the bytes of the set in the portable format of Roaring: 8, then 8 per container, 2 per item of an arr...
friend RoaringBitmap setUnion(const RoaringBitmap &A, const RoaringBitmap &B)
the union, by the merge of the containers
const_iterator select(std::size_t i) const
the item of rank (from 0), end() if size()
std::vector< std::byte > writePortable(void) const
the set in the portable format of Roaring, in an array of its own
std::ptrdiff_t difference_type
the distances
Definition RoaringBitmap.h:474
void forEach(F &&f) const
f( x ) on the items in increasing order
bool insert(std::uint32_t x)
into the set; true if it was not there
RoaringBitmap & operator=(RoaringBitmap o) noexcept
the containers of o, a copy or a move (the copy and swap idiom)
std::size_t size_type
the sizes
Definition RoaringBitmap.h:473
static RoaringBitmap readPortable(std::span< const std::byte > in, std::size_t *used=nullptr)
the set written in the portable format of Roaring at the start of , its containers of runs read as ar...
friend RoaringBitmap setDifference(const RoaringBitmap &A, const RoaringBitmap &B)
the difference, by the merge of the containers
std::uint32_t reference
an item, by value
Definition RoaringBitmap.h:475
std::size_t size(void) const
the number of items
std::size_t bytes(void) const
the bytes of the containers
RoaringBitmap(const std::uint32_t *a, std::size_t n)
the set of the strictly increasing items of , a container per chunk in one scan
std::uint32_t Item
the type of the items
Definition RoaringBitmap.h:162
bool empty(void) const
whether the set has no item
const_iterator cend(void) const
as end()
Definition RoaringBitmap.h:490
std::uint32_t const_reference
an item, by value
Definition RoaringBitmap.h:476
std::uint32_t value_type
the items
Definition RoaringBitmap.h:472
const_iterator cbegin(void) const
as begin()
Definition RoaringBitmap.h:488
bool remove(std::uint32_t x)
out of the set; true if it was there
friend RoaringBitmap setSymmetricDifference(const RoaringBitmap &A, const RoaringBitmap &B)
the symmetric difference, by the merge of the containers
std::size_t rank(std::uint32_t x) const
the items smaller than : the counts of the containers before that of , , and the place of in it
void clear(void)
all the items removed
RoaringBitmap(const RoaringBitmap &o)
a copy, with containers of its own
const_iterator begin(void) const
the iterator on the smallest item
Definition RoaringBitmap.h:480
const_iterator end(void) const
the iterator past the largest item
Definition RoaringBitmap.h:484
friend RoaringBitmap setIntersection(const RoaringBitmap &A, const RoaringBitmap &B)
the intersection, by the merge of the containers
BoolSet setIntersection(const BoolSet &A, const BoolSet &B)
the intersection, a set of dimension
BoolSet setUnion(const BoolSet &A, const BoolSet &B)
the union, a set of dimension
BoolSet setDifference(const BoolSet &A, const BoolSet &B)
the difference, a set of dimension A.dim()
BoolSet setSymmetricDifference(const BoolSet &A, const BoolSet &B)
the symmetric difference, the items in exactly one of and , a set of dimension