Sleipnir C++ API
Loading...
Searching...
No Matches
Print.hpp
Go to the documentation of this file.
1// Copyright (c) Sleipnir contributors
2
3#pragma once
4
5#include <cstdio>
6#include <print>
7#include <system_error>
8#include <utility>
9
10namespace sleipnir {
11
15template <typename... T>
16inline void print(std::format_string<T...> fmt, T&&... args) {
17 try {
18 std::print(fmt, std::forward<T>(args)...);
19 } catch (const std::system_error&) {
20 }
21}
22
26template <typename... T>
27inline void print(std::FILE* f, std::format_string<T...> fmt, T&&... args) {
28 try {
29 std::print(f, fmt, std::forward<T>(args)...);
30 } catch (const std::system_error&) {
31 }
32}
33
37template <typename... T>
38inline void println(std::format_string<T...> fmt, T&&... args) {
39 try {
40 std::println(fmt, std::forward<T>(args)...);
41 } catch (const std::system_error&) {
42 }
43}
44
48template <typename... T>
49inline void println(std::FILE* f, std::format_string<T...> fmt, T&&... args) {
50 try {
51 std::println(f, fmt, std::forward<T>(args)...);
52 } catch (const std::system_error&) {
53 }
54}
55
56} // namespace sleipnir
Definition Expression.hpp:18
IntrusiveSharedPtr< T > AllocateIntrusiveShared(Alloc alloc, Args &&... args)
Definition IntrusiveSharedPtr.hpp:275
void print(std::format_string< T... > fmt, T &&... args)
Definition Print.hpp:16
void println(std::format_string< T... > fmt, T &&... args)
Definition Print.hpp:38