|
TEC
A lightweight C++ library enabling safe, efficient execution in multithreaded and concurrent systems.
|
Provides variadic print and format utilities for the tec namespace. Implemented for compatibility with pre-C++20 compilers. More...
#include <iostream>#include <ostream>#include <sstream>#include <string>#include "tec/tec_def.hpp"Go to the source code of this file.
Functions | |
Print and Format Functions | |
Utility functions for formatted output and string creation. These functions provide flexible printing to output streams and string formatting with support for variadic arguments and placeholder-based formatting using "{}" syntax. | |
| template<typename T > | |
| void | tec::print (std::ostream *out, const T &arg) |
| Outputs a single argument to the specified stream. | |
| template<typename T , typename... Targs> | |
| void | tec::print (std::ostream *out, const char *fmt, const T &value, Targs &&... Args) |
| Outputs variadic arguments to the specified stream with formatting. | |
| template<typename T > | |
| void | tec::println (std::ostream *out, const T &arg) |
| Outputs a single argument to the specified stream with a newline. | |
| template<typename T , typename... Targs> | |
| void | tec::println (std::ostream *out, const char *fmt, const T &value, Targs &&... Args) |
| Outputs variadic arguments to the specified stream with formatting and a newline. | |
| template<typename T > | |
| void | tec::print (const T &arg) |
| Outputs a single argument to std::cout. | |
| template<typename T , typename... Targs> | |
| void | tec::print (const char *fmt, const T &value, Targs &&... Args) |
| Outputs variadic arguments to std::cout with formatting. | |
| template<typename T > | |
| void | tec::println (const T &arg) |
| Outputs a single argument to std::cout with a newline. | |
| template<typename T , typename... Targs> | |
| void | tec::println (const char *fmt, const T &value, Targs &&... Args) |
| Outputs variadic arguments to std::cout with formatting and a newline. | |
| template<typename T > | |
| std::string | tec::format (const T &arg) |
| Formats a single argument into a string. | |
| template<typename T , typename... Targs> | |
| std::string | tec::format (const char *fmt, const T &value, Targs &&... Args) |
| Formats variadic arguments into a string. | |
Provides variadic print and format utilities for the tec namespace. Implemented for compatibility with pre-C++20 compilers.
| std::string tec::format | ( | const char * | fmt, |
| const T & | value, | ||
| Targs &&... | Args | ||
| ) |
Formats variadic arguments into a string.
Processes a format string with "{}" placeholders, replacing each placeholder with the corresponding argument, and returns the resulting string.
| T | The type of the first argument. |
| Targs | The types of additional arguments. |
| fmt | The format string containing "{}" placeholders. |
| value | The first argument to format. |
| Args | The remaining arguments to format. |
Formats a single argument into a string.
Converts the provided argument to its string representation using an output stream.
| T | The type of the argument to format. |
| arg | The argument to format. |
| void tec::print | ( | const char * | fmt, |
| const T & | value, | ||
| Targs &&... | Args | ||
| ) |
Outputs variadic arguments to std::cout with formatting.
Processes a format string with "{}" placeholders, replacing each placeholder with the corresponding argument, outputting to the standard output stream.
| T | The type of the first argument. |
| Targs | The types of additional arguments. |
| fmt | The format string containing "{}" placeholders. |
| value | The first argument to output. |
| Args | The remaining arguments to output. |
Outputs a single argument to std::cout.
Writes the provided argument to the standard output stream without formatting.
| T | The type of the argument to output. |
| arg | The argument to output. |
| void tec::print | ( | std::ostream * | out, |
| const char * | fmt, | ||
| const T & | value, | ||
| Targs &&... | Args | ||
| ) |
Outputs variadic arguments to the specified stream with formatting.
Processes a format string with "{}" placeholders, replacing each placeholder with the corresponding argument. Recursively handles multiple arguments.
| T | The type of the first argument. |
| Targs | The types of additional arguments. |
| out | Pointer to the output stream (e.g., std::cout or std::ostringstream). |
| fmt | The format string containing "{}" placeholders. |
| value | The first argument to output. |
| Args | The remaining arguments to output. |
Outputs a single argument to the specified stream.
Writes the provided argument to the given output stream without any formatting.
| T | The type of the argument to output. |
| out | Pointer to the output stream (e.g., std::cout or std::ostringstream). |
| arg | The argument to output. |
| void tec::println | ( | const char * | fmt, |
| const T & | value, | ||
| Targs &&... | Args | ||
| ) |
Outputs variadic arguments to std::cout with formatting and a newline.
Processes a format string with "{}" placeholders, replacing each placeholder with the corresponding argument, outputting to the standard output stream, and appending a newline.
| T | The type of the first argument. |
| Targs | The types of additional arguments. |
| fmt | The format string containing "{}" placeholders. |
| value | The first argument to output. |
| Args | The remaining arguments to output. |
Outputs a single argument to std::cout with a newline.
Writes the provided argument to the standard output stream and appends a newline.
| T | The type of the argument to output. |
| arg | The argument to output. |
| void tec::println | ( | std::ostream * | out, |
| const char * | fmt, | ||
| const T & | value, | ||
| Targs &&... | Args | ||
| ) |
Outputs variadic arguments to the specified stream with formatting and a newline.
Processes a format string with "{}" placeholders, replacing each placeholder with the corresponding argument, and appends a newline at the end.
| T | The type of the first argument. |
| Targs | The types of additional arguments. |
| out | Pointer to the output stream (e.g., std::cout or std::ostringstream). |
| fmt | The format string containing "{}" placeholders. |
| value | The first argument to output. |
| Args | The remaining arguments to output. |
Outputs a single argument to the specified stream with a newline.
Writes the provided argument to the given output stream and appends a newline.
| T | The type of the argument to output. |
| out | Pointer to the output stream (e.g., std::cout or std::ostringstream). |
| arg | The argument to output. |