DocWire SDK
DocWire SDK: Award-winning modern data processing in C++20. SourceForge Community Choice & Microsoft support. AI-driven processing. Supports nearly 100 data formats, including email boxes and OCR. Boost efficiency in text extraction, web data extraction, data mining, document analysis. Offline processing possible for security and confidentiality
docwire::imemorystream Class Reference

imemorystream is a stream that wraps a std::span of const std::byte and provides a compatible interface with std::istream. More...

#include <memorystream.h>

Inheritance diagram for docwire::imemorystream:

Public Member Functions

 imemorystream (std::span< const std::byte > source)
 Construct a new imemorystream object. More...
 

Detailed Description

imemorystream is a stream that wraps a std::span of const std::byte and provides a compatible interface with std::istream.

C++20 introduced std::span, which is a utility class that provides a way to access a contiguous sequence of elements. imemorystream is a stream that wraps std::span<const std::byte> and provides a compatible interface with std::istream.

Unlike std::istringstream, imemorystream does not make a copy of the underlying data. It uses a std::span to provide a way to access the data.

There are several alternatives to using imemorystream, such as std::istringstream, but they have a few limitations:

  • std::istringstream requires a copy of the data.
  • std::istrstream is deprecated in C++11 and removed in C++26.
  • std::ispanstream but it requires C++23

imemorystream is a drop-in replacement for std::istrstream and is compatible with C++20 and later.

Definition at line 112 of file memorystream.h.

Constructor & Destructor Documentation

◆ imemorystream()

docwire::imemorystream::imemorystream ( std::span< const std::byte >  source)
inlineexplicit

Construct a new imemorystream object.

Parameters
sourceThe source data to be used by the stream.

Definition at line 120 of file memorystream.h.


The documentation for this class was generated from the following file: