51 lines
962 B
C++
Executable File
51 lines
962 B
C++
Executable File
// 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
|