[ox/std] Remove ox_strcpy

This commit is contained in:
Gary Talent 2023-12-03 19:03:08 -06:00
parent a8db357360
commit d16bbef282

View File

@ -11,19 +11,6 @@
#include "types.hpp" #include "types.hpp"
#include "typetraits.hpp" #include "typetraits.hpp"
template<typename T1, typename T2>
constexpr T1 ox_strcpy(T1 dest, T2 src) noexcept {
using T1Type = typename ox::remove_reference<decltype(dest[0])>::type;
std::size_t i = 0;
while (src[i]) {
dest[i] = static_cast<T1Type>(src[i]);
++i;
}
// set null terminator
dest[i] = 0;
return dest;
}
template<typename T1, typename T2> template<typename T1, typename T2>
constexpr T1 ox_strncpy(T1 dest, T2 src, std::size_t maxLen) noexcept { constexpr T1 ox_strncpy(T1 dest, T2 src, std::size_t maxLen) noexcept {
using T1Type = typename ox::remove_reference<decltype(dest[0])>::type; using T1Type = typename ox::remove_reference<decltype(dest[0])>::type;
@ -72,7 +59,7 @@ constexpr int ox_strcmp(const T1 &str1, const T2 &str2) noexcept {
template<typename T1, typename T2> template<typename T1, typename T2>
[[nodiscard]] [[nodiscard]]
constexpr int ox_strncmp(T1 str1, T2 str2, const std::size_t maxLen) noexcept { constexpr int ox_strncmp(T1 const&str1, T2 const&str2, const std::size_t maxLen) noexcept {
auto retval = 0; auto retval = 0;
std::size_t i = 0; std::size_t i = 0;
while (i < maxLen && (str1[i] || str2[i])) { while (i < maxLen && (str1[i] || str2[i])) {