src: Don't allow const char * in 2nd argument of strieq_l(S[N], T)
This commit is contained in:
parent
1bbb241baa
commit
dad61d032e
11
src/util.h
11
src/util.h
|
@ -296,14 +296,9 @@ bool strieq_l(const CharT(&a)[N], InputIt b, size_t blen) {
|
||||||
return strieq(a, a + (N - 1), b, b + blen);
|
return strieq(a, a + (N - 1), b, b + blen);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename CharT, size_t N>
|
template <typename CharT, size_t N, typename T>
|
||||||
bool strieq_l(const CharT(&a)[N], const std::string &b) {
|
bool strieq_l(const CharT(&a)[N], const T &b) {
|
||||||
return strieq(a, a + (N - 1), std::begin(b), std::end(b));
|
return strieq(a, a + (N - 1), b.begin(), b.end());
|
||||||
}
|
|
||||||
|
|
||||||
template <typename CharT, size_t N>
|
|
||||||
bool strieq_l(const CharT(&a)[N], const StringRef &b) {
|
|
||||||
return strieq(a, a + (N - 1), std::begin(b), std::end(b));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename InputIt1, typename InputIt2>
|
template <typename InputIt1, typename InputIt2>
|
||||||
|
|
|
@ -91,11 +91,11 @@ void test_util_strieq(void) {
|
||||||
CU_ASSERT(!util::strieq_l("alpha", "AlPhA ", 6));
|
CU_ASSERT(!util::strieq_l("alpha", "AlPhA ", 6));
|
||||||
CU_ASSERT(!util::strieq_l("", "AlPhA ", 6));
|
CU_ASSERT(!util::strieq_l("", "AlPhA ", 6));
|
||||||
|
|
||||||
CU_ASSERT(util::strieq_l("alpha", "alpha"));
|
CU_ASSERT(util::strieq_l("alpha", StringRef::from_lit("alpha")));
|
||||||
CU_ASSERT(util::strieq_l("alpha", "AlPhA"));
|
CU_ASSERT(util::strieq_l("alpha", StringRef::from_lit("AlPhA")));
|
||||||
CU_ASSERT(util::strieq_l("", ""));
|
CU_ASSERT(util::strieq_l("", StringRef{}));
|
||||||
CU_ASSERT(!util::strieq_l("alpha", "AlPhA "));
|
CU_ASSERT(!util::strieq_l("alpha", StringRef::from_lit("AlPhA ")));
|
||||||
CU_ASSERT(!util::strieq_l("", "AlPhA "));
|
CU_ASSERT(!util::strieq_l("", StringRef::from_lit("AlPhA ")));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_util_inp_strlower(void) {
|
void test_util_inp_strlower(void) {
|
||||||
|
|
Loading…
Reference in New Issue