Added static_assert for transmitting numbers

This commit is contained in:
BlackMark 2019-08-03 16:11:21 +02:00
parent ecdefe40e7
commit 2a07744575

View File

@ -107,7 +107,7 @@ class Uart {
template <typename T, size_t Base = 10> template <typename T, size_t Base = 10>
static inline void txNumber(const T &val) static inline void txNumber(const T &val)
{ {
// static_assert(util::is_integral_v<T>, "Only supported on integral types"); static_assert(util::is_integral_v<T>, "Only supported on integral types");
constexpr size_t numDigits = detail::maxNumDigits<T, Base>(); constexpr size_t numDigits = detail::maxNumDigits<T, Base>();
typename Driver::data_t buffer[numDigits]; typename Driver::data_t buffer[numDigits];
@ -175,10 +175,10 @@ class Uart {
return *this; return *this;
} }
template <typename... Ts> Uart &operator<<(const unsigned int &val)
Uart &operator<<(unsigned int) const
{ {
static_assert(util::always_false_v<Ts...>, "Not implemented"); txNumber(val);
return *this;
} }
template <typename... Ts> template <typename... Ts>
@ -223,10 +223,10 @@ class Uart {
static_assert(util::always_false_v<Ts...>, "Not implemented"); static_assert(util::always_false_v<Ts...>, "Not implemented");
} }
template <typename... Ts> Uart &operator<<(const bool &val)
Uart &operator<<(bool) const
{ {
static_assert(util::always_false_v<Ts...>, "Not implemented"); txString(val ? F("true") : F("false"));
return *this;
} }
template <typename... Ts> template <typename... Ts>