LibraryLink Utilities  3.0.1
Modern C++ wrapper over LibraryLink and WSTP
LLU::WS::PutAs Struct Reference

Description

Utility structure used to enforce sending given value with encoding E via WSStream.

Template Parameters
E- desired encoding
T- actual type of the expression

This structure is only supposed to be used as a wrapper for arguments to WSStream::operator<<

Note
It's recommended not to use WS::PutAs constructor directly, but rather utilize a helper function WS::putAs.
WSStream<WS::Encoding::Byte> mls { mlink }; // mls will send all strings as if they were ascii-encoded by default
std::string stringWithNonAsciiChars = ...; // oops, now we have to use different encoding
mls << WS::putAs<WS::Encoding::UTF8>(stringWithNonAsciiChars); // this will use UTF8 encoding when sending the string

#include <EncodingTraits.hpp>