flatten 20260225
This commit is contained in:
50
tjp/core/string/cmp.cpp
Executable file
50
tjp/core/string/cmp.cpp
Executable file
@@ -0,0 +1,50 @@
|
||||
// License: Modified MIT (NON-AI)
|
||||
// See the LICENSE file in the root directory for license information.
|
||||
// Copyright 2025 Timothy Prepscius
|
||||
#ifdef TJP_CORE_HEADER_ONLY
|
||||
#pragma once
|
||||
#endif
|
||||
#include "../header_only/compile.h"
|
||||
|
||||
#include "cmp.hpp"
|
||||
#include "strncmp.h"
|
||||
|
||||
namespace tjp::core {
|
||||
|
||||
TJP_CORE_HEADER_ONLY_INLINE
|
||||
int cmp(const String &l, const String &r)
|
||||
{
|
||||
return strncmp(l.c_str(), l.size(), r.c_str(), r.size());
|
||||
}
|
||||
|
||||
TJP_CORE_HEADER_ONLY_INLINE
|
||||
bool less(const String &l, const String &r)
|
||||
{
|
||||
return l < r;
|
||||
}
|
||||
|
||||
TJP_CORE_HEADER_ONLY_INLINE
|
||||
bool equal(const String &l, String &r)
|
||||
{
|
||||
return l == r;
|
||||
}
|
||||
|
||||
TJP_CORE_HEADER_ONLY_INLINE
|
||||
int cmp(const StringView &l, const StringView &r)
|
||||
{
|
||||
return strncmp(l.data(), l.size(), r.data(), r.size());
|
||||
}
|
||||
|
||||
TJP_CORE_HEADER_ONLY_INLINE
|
||||
bool less(const StringView &l, const StringView &r)
|
||||
{
|
||||
return l < r;
|
||||
}
|
||||
|
||||
TJP_CORE_HEADER_ONLY_INLINE
|
||||
bool equal(const StringView &l, const StringView &r)
|
||||
{
|
||||
return l == r;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
Reference in New Issue
Block a user