components/ads131m08/uint_str.h
2026-05-01 15:36:27 +02:00

29 lines
789 B
C++

#pragma once
#include <cstdint>
namespace esphome {
namespace ads131m08 {
template<typename chartype> struct ci_char_traits : public std::char_traits<chartype> {
static bool eq(chartype c1, chartype c2) { return c1 == c2; }
static bool ne(chartype c1, chartype c2) { return c1 != c2; }
static bool lt(chartype c1, chartype c2) { return c1 < c2; }
static int compare(const chartype *a, const chartype *b, size_t _Count) {
for (; 0 < _Count; --_Count, ++a, ++b) {
if (*a == *b)
continue;
return (*a < *b ? -1 : +1);
}
return (0);
}
};
template<typename chartype> class uint_str {
public:
typedef std::basic_string<chartype, ci_char_traits<chartype>, std::allocator<chartype> > Ty_string;
};
} // namespace ads131m08
} // namespace esphome