Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
thread_pool_fmt.h
Go to the documentation of this file.
1// BSD 3-Clause License
2// Copyright (c) 2024, 🍀☀🌕🌥 🌊
3// See the LICENSE file in the project root for full license information.
4
5#pragma once
6
21// Deprecation warning is disabled for internal includes.
22// Define KCENON_THREAD_INTERNAL_INCLUDE before including to suppress the warning.
23#if !defined(KCENON_THREAD_INTERNAL_INCLUDE)
24#if defined(__GNUC__) || defined(__clang__)
25#pragma message("thread_pool_fmt.h is deprecated. Include <kcenon/thread/formatters.h> instead.")
26#elif defined(_MSC_VER)
27#pragma message("thread_pool_fmt.h is deprecated. Include <kcenon/thread/formatters.h> instead.")
28#endif
29#endif
30
32
33#include <format>
34#include <string>
35#include <string_view>
36
37// Forward declaration
38namespace kcenon::thread {
39class thread_pool;
40}
41
53template <>
54struct std::formatter<kcenon::thread::thread_pool> : std::formatter<std::string_view>
55{
63 template <typename FormatContext>
64 auto format(const kcenon::thread::thread_pool& item, FormatContext& ctx) const
65 {
66 return std::formatter<std::string_view>::format(item.to_string(), ctx);
67 }
68};
69
75template <>
76struct std::formatter<kcenon::thread::thread_pool, wchar_t>
77 : std::formatter<std::wstring_view, wchar_t>
78{
86 template <typename FormatContext>
87 auto format(const kcenon::thread::thread_pool& item, FormatContext& ctx) const
88 {
89 auto str = item.to_string();
91 return std::formatter<std::wstring_view, wchar_t>::format(wstr, ctx);
92 }
93};
A thread pool for concurrent execution of jobs using multiple worker threads.
auto to_string(void) const -> std::string
Provides a string representation of this thread_pool.
static auto to_wstring(const std::string &value) -> std::tuple< std::optional< std::wstring >, std::optional< std::string > >
Converts a std::string (system-encoded) to a std::wstring.
String encoding conversion, Base64 encoding/decoding utilities.
Core threading foundation of the thread system library.
Definition thread_impl.h:17
auto format(const kcenon::thread::thread_pool &item, FormatContext &ctx) const
Formats a thread_pool object as a wide string.
auto format(const kcenon::thread::thread_pool &item, FormatContext &ctx) const
Formats a thread_pool object as a string.