Mundy: Multibody Nonlocal Dynamics Version of the Day
Loading...
Searching...
No Matches
StringSink.hpp File Reference

Helpers for building message strings with << syntax. More...

Classes

struct  mundy::SinkStart
struct  mundy::StringLiteralSink< N >
 Sink that still represents a compile-time string. More...
struct  mundy::StringSink< Chunks >
 Sink that stores streamed chunks until a string is actually needed. More...
struct  mundy::is_string_literal_sink< T >
struct  mundy::is_string_literal_sink< StringLiteralSink< N > >
struct  mundy::is_string_sink< T >
struct  mundy::is_string_sink< StringSink< Chunks... > >

Namespaces

namespace  mundy

Concepts

concept  mundy::LiteralStringSink
concept  mundy::ChunkedStringSink
concept  mundy::AnyStringSink
concept  mundy::CompileTimeStringSink

Functions

constexpr SinkStart mundy::sink ()
 Start a new sink pipeline.
template<impl::RuntimeSinkChunk T>
constexpr auto mundy::operator<< (SinkStart, T &&rhs)
template<size_t N>
constexpr auto mundy::operator<< (SinkStart, const char(&rhs)[N])
template<size_t N>
constexpr auto mundy::operator<< (SinkStart, const StringLiteral< N > &rhs)
template<size_t N>
std::ostream & mundy::operator<< (std::ostream &os, const StringLiteralSink< N > &sink_to_print)
template<typename... Chunks>
std::ostream & mundy::operator<< (std::ostream &os, const StringSink< Chunks... > &sink_to_print)

Variables

template<typename T>
constexpr bool mundy::is_string_literal_sink_v = is_string_literal_sink<std::remove_cvref_t<T>>::value
template<typename T>
constexpr bool mundy::is_string_sink_v = is_string_sink<std::remove_cvref_t<T>>::value

Detailed Description

mundy::sink() starts a message-building pipeline. Literal-only pipelines stay in a StringLiteralSink, so they remain usable in constexpr code and in device-only paths that require compile-time strings. Appending any non-literal streamable object promotes the pipeline to a StringSink, which stores the streamed chunks lazily and materializes a std::string only when needed.

Typical usage:

constexpr auto device_message = mundy::sink() << "entity " << "was not found";
auto host_message = mundy::sink() << "Failure for a = " << a;
constexpr SinkStart sink()
Start a new sink pipeline.
Definition StringSink.hpp:331