std::size_t count,
Char ch) noexcept(false) {
detail::fixedstring::checkOverflow(count, N - size_);
- for (std::size_t i = 0u; i < count; ++i)
+ for (std::size_t i = 0u; i < count; ++i) {
data_[size_ + i] = ch;
+ }
size_ += count;
data_[size_] = Char(0);
return *this;
detail::fixedstring::checkOverflow(pos, that.size_);
count = detail::fixedstring::checkOverflowOrNpos(count, that.size_ - pos);
detail::fixedstring::checkOverflow(count, N - size_);
- for (std::size_t i = 0u; i < count; ++i)
+ for (std::size_t i = 0u; i < count; ++i) {
data_[size_ + i] = that.data_[pos + i];
+ }
size_ += count;
data_[size_] = Char(0);
return *this;
const Char* that,
std::size_t count) noexcept(false) {
detail::fixedstring::checkOverflow(count, N - size_);
- for (std::size_t i = 0u; i < count; ++i)
+ for (std::size_t i = 0u; i < count; ++i) {
data_[size_ + i] = that[i];
+ }
size_ += count;
data_[size_] = Char(0);
return *this;
copy(Char* dest, std::size_t count, std::size_t pos) const noexcept(false) {
detail::fixedstring::checkOverflow(pos, size_);
for (std::size_t i = 0u; i < count; ++i) {
- if (i + pos == size_)
+ if (i + pos == size_) {
return size_;
+ }
dest[i] = data_[i + pos];
}
return count;
// "const std::size_t&" is so that folly::npos has the same address in every
// translation unit. This is to avoid potential violations of the ODR.
constexpr const std::size_t& npos = detail::fixedstring::FixedStringBase::npos;
-}
+} // namespace
#if defined(__GNUC__)
#pragma GCC diagnostic push
FOLLY_DEFINE_FIXED_STRING_UDL(128)
#undef FOLLY_DEFINE_FIXED_STRING_UDL
-}
-}
+} // namespace string_literals
+} // namespace literals
// TODO:
// // numeric conversions:
// constexpr FixedString</*...*/> to_fixed_string_ll() noexcept
// template <unsigned long long val>
// constexpr FixedString</*...*/> to_fixed_string_ull() noexcept;
-}
+} // namespace folly