check for non-ASCII local-parts without SMTPUTF8
[ghsmtp.git] / is_ascii.hpp
blob43cbff9b6164d1b513f413bdeaf25feef8026ff9
1 #include <algorithm>
2 #include <string_view>
4 constexpr bool isascii(char c) noexcept
6 return (static_cast<unsigned char>(c) & 0x80) == 0;
9 constexpr bool is_ascii(std::string_view str) noexcept
11 return !std::any_of(std::begin(str), std::end(str), [](char ch) {
12 return !isascii(static_cast<unsigned char>(ch));
13 });