lets see if this makes thing less slow on windows
This commit is contained in:
parent
7082765060
commit
39e4a4bb90
|
@ -5,6 +5,11 @@
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <format>
|
#include <format>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define _WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace swbf {
|
namespace swbf {
|
||||||
struct FputcIterator {
|
struct FputcIterator {
|
||||||
using iterator_category = std::output_iterator_tag;
|
using iterator_category = std::output_iterator_tag;
|
||||||
|
@ -30,6 +35,11 @@ namespace swbf {
|
||||||
/// Poor Man's C++23
|
/// Poor Man's C++23
|
||||||
template<class ...Args>
|
template<class ...Args>
|
||||||
inline void fprint(std::FILE* file, std::string_view format, Args&&... args) {
|
inline void fprint(std::FILE* file, std::string_view format, Args&&... args) {
|
||||||
|
#ifdef _WIN32
|
||||||
|
auto str = std::vformat(format, std::make_format_args(args...));
|
||||||
|
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), str.data(), str.length(), nullptr, nullptr);
|
||||||
|
#else
|
||||||
std::vformat_to(FputcIterator(file), format, std::make_format_args(args...));
|
std::vformat_to(FputcIterator(file), format, std::make_format_args(args...));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
} // namespace swbf
|
} // namespace swbf
|
||||||
|
|
Loading…
Reference in New Issue