mirror of
https://github.com/fmtlib/fmt.git
synced 2026-07-30 16:26:27 +08:00
add static assertion to prevent lossy type conversion
This commit is contained in:
parent
18ae3f4080
commit
1ff672025a
@ -1808,6 +1808,7 @@ template <typename T> class buffer {
|
||||
/// Appends data to the end of the buffer.
|
||||
template <typename U>
|
||||
FMT_CONSTEXPR20 void append(const U* begin, const U* end) {
|
||||
static_assert(std::is_same<T, U>::value || std::is_same<U, char>::value);
|
||||
while (begin != end) {
|
||||
auto size = size_;
|
||||
auto free_cap = capacity_ - size;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user