[ox/std] Remove ox_strcpy
This commit is contained in:
parent
a8db357360
commit
d16bbef282
15
deps/ox/src/ox/std/cstrops.hpp
vendored
15
deps/ox/src/ox/std/cstrops.hpp
vendored
@ -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])) {
|
||||||
|
Loading…
Reference in New Issue
Block a user