24 constexpr SetOfChars() {}
26 constexpr SetOfChars(
char c) {
36 }
else if (c < 32 || c >= 127) {
44 bits_ =
static_cast<std::uint64_t
>(1) << (c - 32);
47 constexpr SetOfChars(
const char str[], std::size_t n) {
48 for (std::size_t j{0}; j < n; ++j) {
49 bits_ |= SetOfChars{str[j]}.bits_;
53 constexpr SetOfChars(
const SetOfChars &) =
default;
54 constexpr SetOfChars(SetOfChars &&) =
default;
55 constexpr SetOfChars &operator=(
const SetOfChars &) =
default;
56 constexpr SetOfChars &operator=(SetOfChars &&) =
default;
57 constexpr bool empty()
const {
return bits_ == 0; }
59 constexpr bool Has(SetOfChars that)
const {
60 return (that.bits_ & ~bits_) == 0;
62 constexpr SetOfChars Union(SetOfChars that)
const {
63 return SetOfChars{bits_ | that.bits_};
65 constexpr SetOfChars Intersection(SetOfChars that)
const {
66 return SetOfChars{bits_ & that.bits_};
68 constexpr SetOfChars Difference(SetOfChars that)
const {
69 return SetOfChars{bits_ & ~that.bits_};
72 std::string ToString()
const;
75 constexpr SetOfChars(std::uint64_t b) : bits_{b} {}
76 std::uint64_t bits_{0};