From 654131c5436133c68a2c53d8efb0879e6ab8cf45 Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Thu, 17 Apr 2025 20:08:36 -0400 Subject: [PATCH] common/async: Add concepts.h Asio does not have nearly as many actual explicit concepts one can use as one might like. And there's no reason we might not want our own asynchrony-related concepts. Signed-off-by: Adam C. Emerson (cherry picked from commit 07c77b0c886799ec0cfa7419ecdb72cb242f6af7) Signed-off-by: Adam C. Emerson --- src/common/async/concepts.h | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/common/async/concepts.h diff --git a/src/common/async/concepts.h b/src/common/async/concepts.h new file mode 100644 index 0000000000000..ad960b6ab8d31 --- /dev/null +++ b/src/common/async/concepts.h @@ -0,0 +1,41 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab ft=cpp + +/* + * Ceph - scalable distributed file system + * + * Copyright contributors to the Ceph project + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + * + */ + +#pragma once + +#include + +#include +#include + +/// \file common/async/concepts +/// +/// \brief Because Asio needs to implement more concepts + +namespace ceph::async { + +/// The constraint from functions taking an ExecutionContext packed +/// into a concept. +template +concept execution_context = + std::is_convertible_v; + +/// A concept for Asio 'disposition's, a generalization of error +/// codes/exception pointers, etc. +template +concept disposition = + boost::asio::is_disposition_v; +} -- 2.39.5