Add execution::invocable_archetype.
This commit is contained in:
parent
7bdae05db9
commit
f14dbd716c
@ -365,6 +365,7 @@ sub copy_include_files
|
||||
"include/asio",
|
||||
"include/asio/detail",
|
||||
"include/asio/detail/impl",
|
||||
"include/asio/execution",
|
||||
"include/asio/experimental",
|
||||
"include/asio/experimental/impl",
|
||||
"include/asio/generic",
|
||||
@ -429,6 +430,7 @@ sub copy_unit_tests
|
||||
my @dirs = (
|
||||
"src/tests/unit",
|
||||
"src/tests/unit/archetypes",
|
||||
"src/tests/unit/execution",
|
||||
"src/tests/unit/generic",
|
||||
"src/tests/unit/ip",
|
||||
"src/tests/unit/local",
|
||||
|
@ -291,6 +291,7 @@ nobase_include_HEADERS = \
|
||||
asio/error_code.hpp \
|
||||
asio/error.hpp \
|
||||
asio/execution_context.hpp \
|
||||
asio/execution/invocable_archetype.hpp \
|
||||
asio/executor.hpp \
|
||||
asio/executor_work_guard.hpp \
|
||||
asio/generic/basic_endpoint.hpp \
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include "asio/dispatch.hpp"
|
||||
#include "asio/error.hpp"
|
||||
#include "asio/error_code.hpp"
|
||||
#include "asio/execution/invocable_archetype.hpp"
|
||||
#include "asio/execution_context.hpp"
|
||||
#include "asio/executor.hpp"
|
||||
#include "asio/executor_work_guard.hpp"
|
||||
|
@ -90,6 +90,24 @@
|
||||
ASIO_MOVE_ARG(T3) x3, ASIO_MOVE_ARG(T4) x4, \
|
||||
ASIO_MOVE_ARG(T5) x5
|
||||
|
||||
# define ASIO_VARIADIC_UNNAMED_MOVE_PARAMS(n) \
|
||||
ASIO_VARIADIC_UNNAMED_MOVE_PARAMS_##n
|
||||
|
||||
# define ASIO_VARIADIC_UNNAMED_MOVE_PARAMS_1 \
|
||||
ASIO_MOVE_ARG(T1)
|
||||
# define ASIO_VARIADIC_UNNAMED_MOVE_PARAMS_2 \
|
||||
ASIO_MOVE_ARG(T1), ASIO_MOVE_ARG(T2)
|
||||
# define ASIO_VARIADIC_UNNAMED_MOVE_PARAMS_3 \
|
||||
ASIO_MOVE_ARG(T1), ASIO_MOVE_ARG(T2), \
|
||||
ASIO_MOVE_ARG(T3)
|
||||
# define ASIO_VARIADIC_UNNAMED_MOVE_PARAMS_4 \
|
||||
ASIO_MOVE_ARG(T1), ASIO_MOVE_ARG(T2), \
|
||||
ASIO_MOVE_ARG(T3), ASIO_MOVE_ARG(T4)
|
||||
# define ASIO_VARIADIC_UNNAMED_MOVE_PARAMS_5 \
|
||||
ASIO_MOVE_ARG(T1), ASIO_MOVE_ARG(T2), \
|
||||
ASIO_MOVE_ARG(T3), ASIO_MOVE_ARG(T4), \
|
||||
ASIO_MOVE_ARG(T5)
|
||||
|
||||
# define ASIO_VARIADIC_MOVE_ARGS(n) \
|
||||
ASIO_VARIADIC_MOVE_ARGS_##n
|
||||
|
||||
|
66
asio/include/asio/execution/invocable_archetype.hpp
Normal file
66
asio/include/asio/execution/invocable_archetype.hpp
Normal file
@ -0,0 +1,66 @@
|
||||
//
|
||||
// execution/invocable_archetype.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef ASIO_EXECUTION_INVOCABLE_ARCHETYPE_HPP
|
||||
#define ASIO_EXECUTION_INVOCABLE_ARCHETYPE_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
||||
|
||||
#include "asio/detail/config.hpp"
|
||||
#include "asio/detail/type_traits.hpp"
|
||||
#include "asio/detail/variadic_templates.hpp"
|
||||
|
||||
#include "asio/detail/push_options.hpp"
|
||||
|
||||
namespace asio {
|
||||
namespace execution {
|
||||
|
||||
/// An archetypal function object used for determining adherence to the
|
||||
/// execution::executor concept.
|
||||
struct invocable_archetype
|
||||
{
|
||||
#if defined(ASIO_HAS_VARIADIC_TEMPLATES) \
|
||||
|| defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
/// Function call operator.
|
||||
template <typename... Args>
|
||||
void operator()(ASIO_MOVE_ARG(Args)...)
|
||||
{
|
||||
}
|
||||
|
||||
#else // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
// || defined(GENERATING_DOCUMENTATION)
|
||||
|
||||
void operator()()
|
||||
{
|
||||
}
|
||||
|
||||
#define ASIO_PRIVATE_INVOCABLE_ARCHETYPE_CALL_DEF(n) \
|
||||
template <ASIO_VARIADIC_TPARAMS(n)> \
|
||||
void operator()(ASIO_VARIADIC_UNNAMED_MOVE_PARAMS(n)) \
|
||||
{ \
|
||||
} \
|
||||
/**/
|
||||
ASIO_VARIADIC_GENERATE(ASIO_PRIVATE_INVOCABLE_ARCHETYPE_CALL_DEF)
|
||||
#undef ASIO_PRIVATE_INVOCABLE_ARCHETYPE_CALL_DEF
|
||||
|
||||
#endif // defined(ASIO_HAS_VARIADIC_TEMPLATES)
|
||||
// || defined(GENERATING_DOCUMENTATION)
|
||||
};
|
||||
|
||||
} // namespace execution
|
||||
} // namespace asio
|
||||
|
||||
#include "asio/detail/pop_options.hpp"
|
||||
|
||||
#endif // ASIO_EXECUTION_INVOCABLE_ARCHETYPE_HPP
|
||||
|
@ -147,6 +147,7 @@ UNIT_TEST_EXES = \
|
||||
tests\unit\dispatch.exe \
|
||||
tests\unit\error.exe \
|
||||
tests\unit\execution_context.exe \
|
||||
tests\unit\execution\invocable_archetype.exe \
|
||||
tests\unit\executor.exe \
|
||||
tests\unit\executor_work_guard.exe \
|
||||
tests\unit\generic\basic_endpoint.exe \
|
||||
|
@ -43,6 +43,7 @@ check_PROGRAMS = \
|
||||
unit/detached \
|
||||
unit/dispatch \
|
||||
unit/error \
|
||||
unit/execution/invocable_archetype \
|
||||
unit/execution_context \
|
||||
unit/executor \
|
||||
unit/executor_work_guard \
|
||||
@ -184,6 +185,7 @@ TESTS = \
|
||||
unit/detached \
|
||||
unit/dispatch \
|
||||
unit/error \
|
||||
unit/execution/invocable_archetype \
|
||||
unit/execution_context \
|
||||
unit/executor \
|
||||
unit/executor_work_guard \
|
||||
@ -325,6 +327,7 @@ unit_defer_SOURCES = unit/defer.cpp
|
||||
unit_detached_SOURCES = unit/detached.cpp
|
||||
unit_dispatch_SOURCES = unit/dispatch.cpp
|
||||
unit_error_SOURCES = unit/error.cpp
|
||||
unit_execution_invocable_archetype_SOURCES = unit/execution/invocable_archetype.cpp
|
||||
unit_execution_context_SOURCES = unit/execution_context.cpp
|
||||
unit_executor_SOURCES = unit/executor.cpp
|
||||
unit_executor_work_guard_SOURCES = unit/executor_work_guard.cpp
|
||||
|
10
asio/src/tests/unit/execution/.gitignore
vendored
Normal file
10
asio/src/tests/unit/execution/.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
.deps
|
||||
.dirstamp
|
||||
*.o
|
||||
*.obj
|
||||
*.exe
|
||||
*.ilk
|
||||
*.manifest
|
||||
*.pdb
|
||||
*.tds
|
||||
invocable_archetype
|
25
asio/src/tests/unit/execution/invocable_archetype.cpp
Normal file
25
asio/src/tests/unit/execution/invocable_archetype.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
//
|
||||
// invocable_archetype.cpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
// Disable autolinking for unit tests.
|
||||
#if !defined(BOOST_ALL_NO_LIB)
|
||||
#define BOOST_ALL_NO_LIB 1
|
||||
#endif // !defined(BOOST_ALL_NO_LIB)
|
||||
|
||||
// Test that header file is self-contained.
|
||||
#include "asio/execution/invocable_archetype.hpp"
|
||||
|
||||
#include "../unit_test.hpp"
|
||||
|
||||
ASIO_TEST_SUITE
|
||||
(
|
||||
"invocable_archetype",
|
||||
ASIO_TEST_CASE(null_test)
|
||||
)
|
Loading…
Reference in New Issue
Block a user