代码拉取完成,页面将自动刷新
/*
* Copyright (c) -2024
* Liccsu
* All rights reserved.
*
* This software is provided under the terms of the GPL License.
* Please refer to the accompanying LICENSE file for detailed information.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GPL License for more details.
*
* For further inquiries, please contact:
* liccsu@163.com
*/
#ifndef TINYWEBSERVER_FMT_HPP
#define TINYWEBSERVER_FMT_HPP
#include <cstdio>
#include <type_traits>
#include <utility>
class Fmt {
char buf_[64]{};
size_t length_;
public:
template<typename T>
[[maybe_unused]]
Fmt(const char *format, T &&value) {
static_assert(std::is_arithmetic_v<T>, "Must be arithmetic type");
length_ = std::snprintf(buf_, sizeof(buf_), format, std::forward<T>(value));
}
[[nodiscard]]
const char *data() const {
return buf_;
}
[[nodiscard]]
size_t length() const {
return length_;
}
};
#endif //TINYWEBSERVER_FMT_HPP
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。