utils: data_input: replace enable_if with tightened concept

std::is_fundamental isn't a good constraint since it include nullptr_t
and void. Replace with std::integral which is sufficient. Use a concept
instead of enable_if to simplify the code.

Closes #8450
This commit is contained in:
Avi Kivity
2021-04-10 00:07:59 +03:00
committed by Nadav Har'El
parent d5121d1476
commit ec3db140cb

View File

@@ -24,6 +24,7 @@
#include "bytes.hh"
#include <seastar/net/byteorder.hh>
#include <concepts>
class data_input {
public:
@@ -90,8 +91,8 @@ public:
}
private:
template<typename T> size_t ssize(const T &) const;
template<typename T>
inline std::enable_if_t<std::is_fundamental<T>::value, T> peek_primitive() const {
template<std::integral T>
inline T peek_primitive() const {
ensure(sizeof(T));
T t;
std::copy_n(_view.begin(), sizeof(T), reinterpret_cast<char *>(&t));