VOX
A little voxel engine
Loading...
Searching...
No Matches
ft_format.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <cstdio>
5
6template<typename... Args>
7std::string ft_format(const std::string & format, Args... args)
8{
9 size_t size = snprintf(nullptr, 0, format.c_str(), args...) + 1;
10 std::string str(size, 0);
11 snprintf(str.data(), size, format.c_str(), args...);
12 str.pop_back();
13 return str;
14}
std::string ft_format(const std::string &format, Args... args)
Definition: ft_format.hpp:7