[ox/std] Cleanup

This commit is contained in:
Gary Talent 2023-12-02 00:33:45 -06:00
parent 95d9aee0cf
commit 611e2fa7cb
2 changed files with 8 additions and 8 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 - 2022 gary@drinkingtea.net
* Copyright 2015 - 2023 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
@ -8,7 +8,7 @@
#pragma once
#if defined(OX_USE_STDLIB)
#if __has_include(<string>)
#include <string>
#endif
@ -200,7 +200,7 @@ class BasicString {
return c_str();
}
#ifdef OX_USE_STDLIB
#if __has_include(<string>)
[[nodiscard]]
inline std::string toStdString() const {
return c_str();
@ -232,7 +232,7 @@ class BasicString {
template<std::size_t SmallStringSize_v>
constexpr BasicString<SmallStringSize_v>::BasicString() noexcept {
if (m_buff.size()) {
if (!m_buff.empty()) {
m_buff[0] = 0;
} else {
m_buff.push_back(0);
@ -242,14 +242,14 @@ constexpr BasicString<SmallStringSize_v>::BasicString() noexcept {
template<std::size_t SmallStringSize_v>
constexpr BasicString<SmallStringSize_v>::BasicString(std::size_t cap) noexcept: m_buff(cap + 1) {
// GCC complains if you don't do this pretty unnecessary size check
if (m_buff.size()) {
if (!m_buff.empty()) {
m_buff[0] = 0;
}
}
template<std::size_t SmallStringSize_v>
constexpr BasicString<SmallStringSize_v>::BasicString(const char *str) noexcept {
if (m_buff.size()) {
if (!m_buff.empty()) {
m_buff[0] = 0;
} else {
m_buff.push_back(0);
@ -259,7 +259,7 @@ constexpr BasicString<SmallStringSize_v>::BasicString(const char *str) noexcept
template<std::size_t SmallStringSize_v>
constexpr BasicString<SmallStringSize_v>::BasicString(const char8_t *str) noexcept {
if (m_buff.size()) {
if (!m_buff.empty()) {
m_buff[0] = 0;
} else {
m_buff.push_back(0);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2015 - 2022 gary@drinkingtea.net
* Copyright 2015 - 2023 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this