Add copy2() constexpr

This commit is contained in:
Roman Koshelev 2021-09-12 18:07:16 +03:00
parent 3a04481485
commit 3f5e3cbb2c

View File

@ -1073,11 +1073,13 @@ inline auto equal2(const char* lhs, const char* rhs) -> bool {
}
// Copies two characters from src to dst.
template <typename Char> void copy2(Char* dst, const char* src) {
*dst++ = static_cast<Char>(*src++);
*dst = static_cast<Char>(*src);
template <typename Char>
FMT_CONSTEXPR void copy2(Char* dst, const char* src) {
char dc0 = *src++;
char dc1 = *src;
*dst++ = static_cast<Char>(dc0);
*dst = static_cast<Char>(dc1);
}
FMT_INLINE void copy2(char* dst, const char* src) { memcpy(dst, src, 2); }
template <typename Iterator> struct format_decimal_result {
Iterator begin;