From e6918187568dbd01842d8d1d2c808ce16a894239 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 21 Apr 2024 13:54:28 +0200 Subject: Adding upstream version 18.2.2. Signed-off-by: Daniel Baumann --- src/msg/async/dpdk/capture.h | 50 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/msg/async/dpdk/capture.h (limited to 'src/msg/async/dpdk/capture.h') diff --git a/src/msg/async/dpdk/capture.h b/src/msg/async/dpdk/capture.h new file mode 100644 index 000000000..1ace8eeb0 --- /dev/null +++ b/src/msg/async/dpdk/capture.h @@ -0,0 +1,50 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2015 XSky + * + * Author: Haomai Wang + * + * 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. + * + */ + +#ifndef CEPH_MSG_DPDK_CAPTURE_H +#define CEPH_MSG_DPDK_CAPTURE_H + +#include + +template +class capture_impl { + T x; + F f; + public: + capture_impl(capture_impl &) = delete; + capture_impl( T && x, F && f ) + : x{std::forward(x)}, f{std::forward(f)} + {} + + template auto operator()( Ts&&...args ) + -> decltype(f( x, std::forward(args)... )) + { + return f( x, std::forward(args)... ); + } + + template auto operator()( Ts&&...args ) const + -> decltype(f( x, std::forward(args)... )) + { + return f( x, std::forward(args)... ); + } +}; + +template +capture_impl capture( T && x, F && f ) { + return capture_impl( + std::forward(x), std::forward(f) ); +} + +#endif //CEPH_MSG_DPDK_CAPTURE_H -- cgit v1.2.3