Return the buffer index and in‐buffer offset for a blob position.

Synopsis

Declared in <bdlbb_blobutil.h>

static
bsl::pair<int, int>
findBufferIndexAndOffset(
    Blob const& blob,
    int position);

Description

Return a value, designated here as p, such that for the specified blob, blob.buffer(p.first) is the buffer that contains the byte at the specified position in blob, and p.second is the offset corresponding to position within said buffer. The behavior of this function is undefined unless 0 <= position, 0 < blob.totalSize(), and position < blob.totalSize(). Note that (1) subsequent changes to blob may invalidate the result of this function, and (2) p.first never indicates a zero‐size buffer.

Return Value

pair of buffer index and in‐buffer offset for position

Parameters

Name

Description

blob

blob in which the position is located

position

byte position within blob

Created with MrDocs