1
0
Fork 0
mirror of https://gitlab.com/niansa/libcrosscoro.git synced 2025-03-06 20:53:32 +01:00
libcrosscoro/inc/coro/concepts/buffer.hpp
Josh Baldwin bc3b956ed3
udp_peer! (#33)
* udp_peer!

I hope using the udp peer makes sense on how udp packets are
sent and received now.  Time will tell!

* Fix broken benchmark tcp server listening race condition
2021-01-09 19:18:03 -07:00

28 lines
586 B
C++

#pragma once
#include <concepts>
#include <type_traits>
#include <cstdint>
namespace coro::concepts
{
// clang-format off
template<typename type>
concept const_buffer = requires(const type t)
{
{ t.empty() } -> std::same_as<bool>;
{ t.data() } -> std::same_as<const char*>;
{ t.size() } -> std::same_as<std::size_t>;
};
template<typename type>
concept mutable_buffer = requires(type t)
{
{ t.empty() } -> std::same_as<bool>;
{ t.data() } -> std::same_as<char*>;
{ t.size() } -> std::same_as<std::size_t>;
};
// clang-format on
} // namespace coro::concepts