src: Parameterize CharT

This commit is contained in:
Tatsuhiro Tsujikawa 2016-02-07 18:16:47 +09:00
parent ede0f6aa32
commit 4fb4617d20
1 changed files with 12 additions and 9 deletions

View File

@ -217,8 +217,8 @@ bool istarts_with(InputIt a, size_t an, const char *b) {
bool istarts_with(const char *a, const char *b);
template <size_t N>
bool istarts_with_l(const std::string &a, const char(&b)[N]) {
template <typename CharT, size_t N>
bool istarts_with_l(const std::string &a, const CharT(&b)[N]) {
return istarts_with(std::begin(a), std::end(a), b, b + N - 1);
}
@ -248,7 +248,8 @@ inline bool iends_with(const std::string &a, const std::string &b) {
return iends_with(std::begin(a), std::end(a), std::begin(b), std::end(b));
}
template <size_t N> bool iends_with_l(const std::string &a, const char(&b)[N]) {
template <typename CharT, size_t N>
bool iends_with_l(const std::string &a, const CharT(&b)[N]) {
return iends_with(std::begin(a), std::end(a), b, b + N - 1);
}
@ -291,12 +292,13 @@ inline bool strieq(const char *a, const std::string &b) {
return strieq(a, b.c_str(), b.size());
}
template <typename InputIt, size_t N>
bool strieq_l(const char(&a)[N], InputIt b, size_t blen) {
template <typename CharT, typename InputIt, size_t N>
bool strieq_l(const CharT(&a)[N], InputIt b, size_t blen) {
return strieq(a, N - 1, b, blen);
}
template <size_t N> bool strieq_l(const char(&a)[N], const std::string &b) {
template <typename CharT, size_t N>
bool strieq_l(const CharT(&a)[N], const std::string &b) {
return strieq(a, N - 1, std::begin(b), b.size());
}
@ -325,12 +327,13 @@ inline bool streq(const char *a, const char *b) {
return streq(a, strlen(a), b, strlen(b));
}
template <typename InputIt, size_t N>
bool streq_l(const char(&a)[N], InputIt b, size_t blen) {
template <typename CharT, typename InputIt, size_t N>
bool streq_l(const CharT(&a)[N], InputIt b, size_t blen) {
return streq(a, N - 1, b, blen);
}
template <size_t N> bool streq_l(const char(&a)[N], const std::string &b) {
template <typename CharT, size_t N>
bool streq_l(const CharT(&a)[N], const std::string &b) {
return streq(a, N - 1, std::begin(b), b.size());
}