ThinSQLite++
A thin, safe and convenient modern C++ wrapper for the SQLite API.
Loading...
Searching...
No Matches
zero_blob Class Reference

An efficient blob of zeroes of a given size. More...

Public Types

using element_type = const std::byte
using value_type = std::byte
using index_type = size_t
using difference_type = ptrdiff_t
using pointer = const std::byte *
using const_pointer = const std::byte *
using reference = const std::byte &
using const_reference = const std::byte &
using iterator = const_iterator
using reverse_iterator = std::reverse_iterator<iterator>
using const_reverse_iterator = std::reverse_iterator<const_iterator>

Public Member Functions

constexpr zero_blob (size_t size=0) noexcept
constexpr zero_blob (const zero_blob &) noexcept=default
constexpr zero_blob & operator= (const zero_blob &) noexcept=default
constexpr zero_blob first (index_type count) const noexcept
constexpr zero_blob last (index_type count) const noexcept
constexpr zero_blob subspan (index_type offset, index_type count=size_t(-1)) const noexcept
constexpr index_type size () const noexcept
constexpr index_type size_bytes () const noexcept
constexpr bool empty () const noexcept
constexpr reference operator[] (index_type idx) const noexcept
constexpr reference front () const noexcept
constexpr reference back () const noexcept
constexpr iterator begin () const noexcept
constexpr iterator end () const noexcept
constexpr const_iterator cbegin () const noexcept
constexpr const_iterator cend () const noexcept
constexpr reverse_iterator rbegin () const noexcept
constexpr reverse_iterator rend () const noexcept
constexpr const_reverse_iterator crbegin () const noexcept
constexpr const_reverse_iterator crend () const noexcept

Detailed Description

An efficient blob of zeroes of a given size.

This class is an STL random-access container that returns 0 for all its elements. It simply stores blob size and doesn't allocate any memory.

SQLite contains optimized methods that operate on "blobs of zeroes" of a given size (e.g. sqlite3_bind_zeroblob). This class is used to pass "blobs of zeroes" to overloaded C++ methods (e.g. statement::bind(int, const zero_blob &)) to achieve the same effect in this library.