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
2021-01-16 20:27:11 -07:00

27 lines
585 B
C++

#pragma once
#include <concepts>
#include <cstdint>
#include <type_traits>
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