diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index c86fedb9..d6b9c64f 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -13,10 +13,10 @@ on: jobs: beman-submodule-check: - uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-submodule-check.yml@1.1.0 + uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-submodule-check.yml@1.2.1 preset-test: - uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-preset-test.yml@1.1.0 + uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-preset-test.yml@1.2.1 with: matrix_config: > [ @@ -29,7 +29,7 @@ jobs: ] build-and-test: - uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-build-and-test.yml@1.1.0 + uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-build-and-test.yml@1.2.1 with: matrix_config: > { @@ -40,7 +40,8 @@ jobs: "tests": [ { "stdlibs": ["libstdc++"], "tests": [ - "Debug.Default", "Release.Default", "Release.MaxSan", + "Debug.Default", "Release.Default", + "Release.MaxSan", "Debug.Werror", "Debug.Dynamic", "Debug.Coverage" ] } @@ -51,7 +52,7 @@ jobs: } ] }, - { "versions": ["14", "13"], + { "versions": ["14"], "tests": [ { "cxxversions": ["c++26", "c++23"], "tests": [{ "stdlibs": ["libstdc++"], "tests": ["Release.Default"]}] @@ -60,11 +61,11 @@ jobs: } ], "clang": [ - { "versions": ["20"], + { "versions": ["21"], "tests": [ {"cxxversions": ["c++26"], "tests": [ - { "stdlibs": ["libstdc++", "libc++"], + { "stdlibs": ["libc++"], "tests": [ "Debug.Default", "Release.Default", "Release.MaxSan", "Debug.Dynamic" @@ -74,16 +75,16 @@ jobs: }, { "cxxversions": ["c++23"], "tests": [ - {"stdlibs": ["libstdc++", "libc++"], "tests": ["Release.Default"]} + {"stdlibs": ["libc++"], "tests": ["Release.Default"]} ] } ] }, - { "versions": ["19"], + { "versions": ["20", "19"], "tests": [ { "cxxversions": ["c++26", "c++23"], "tests": [ - {"stdlibs": ["libstdc++", "libc++"], "tests": ["Release.Default"]} + {"stdlibs": ["libc++"], "tests": ["Release.Default"]} ] } ] @@ -95,7 +96,7 @@ jobs: { "cxxversions": ["c++23"], "tests": [ { "stdlibs": ["stl"], - "tests": ["Debug.Default", "Release.Default"] + "tests": ["Debug.Default", "Release.Default", "Release.MaxSan"] } ] } @@ -107,4 +108,4 @@ jobs: create-issue-when-fault: needs: [preset-test, build-and-test] if: failure() && github.event_name == 'schedule' - uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-create-issue-when-fault.yml@1.1.0 + uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-create-issue-when-fault.yml@1.2.1 diff --git a/.gitignore b/.gitignore index 166fdc85..14a93b42 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,4 @@ docs/html docs/latex docs/code/*.cpp docs/tutorial.md +gcm.cache diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5baf30b5..e67742c9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: # See also: https://github.com/ssciwr/clang-format-wheel # Config file: .clang-format - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v21.1.7 + rev: v21.1.8 hooks: - id: clang-format types_or: [c++, c, json] @@ -32,7 +32,7 @@ repos: # CMake linting and formatting - repo: https://github.com/BlankSpruce/gersemi - rev: 0.23.2 + rev: 0.25.4 hooks: - id: gersemi name: CMake linting @@ -55,7 +55,7 @@ repos: # Config file: pyproject.toml # second Python code formatting - repo: https://github.com/psf/black - rev: 25.11.0 + rev: 26.1.0 hooks: - id: black diff --git a/CMakeLists.txt b/CMakeLists.txt index 409e197c..095c67d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,72 +3,56 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # gersemi: on -cmake_minimum_required(VERSION 3.25...4.2) +cmake_minimum_required(VERSION 3.30...4.2) -#========================== pre project settings =============================== -# gersemi: off -if(CMAKE_VERSION VERSION_EQUAL 4.2) - set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "d0edc3af-4c50-42ea-a356-e2862fe7a444") - - if(CMAKE_CXX_STDLIB_MODULES_JSON) - message( - STATUS - "CMAKE_CXX_STDLIB_MODULES_JSON=${CMAKE_CXX_STDLIB_MODULES_JSON}" - ) - endif() -endif() -# gersemi: on -#=============================================================================== +include(./cmake/prelude.cmake) #=================================================== -project(beman_execution VERSION 0.0.1 LANGUAGES CXX) +project(beman.execution VERSION 0.2.0 LANGUAGES CXX) #=================================================== -if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) - message(FATAL_ERROR "In-source builds are not allowed!") -endif() +# Modules opt in only on compilers that support it: msvc, g++-15 and clang-20+ +include(./cmake/cxx-modules-rules.cmake) -set(TARGET_NAME execution) -set(TARGET_NAMESPACE beman) -set(TARGET_PREFIX ${TARGET_NAMESPACE}.${TARGET_NAME}) -set(TARGET_LIBRARY ${PROJECT_NAME}) -set(TARGET_ALIAS ${TARGET_NAMESPACE}::${TARGET_NAME}) -set(TARGET_PACKAGE_NAME ${PROJECT_NAME}-config) -set(TARGETS_EXPORT_NAME ${PROJECT_NAME}-config-targets) - -#========================== post project settings ============================== -# Tell CMake that we explicitly want `import std`. -# This will initialize the property on all targets declared after this to 1 -message(STATUS "CMAKE_CXX_COMPILER_IMPORT_STD=${CMAKE_CXX_COMPILER_IMPORT_STD}") -if(${CMAKE_CXX_STANDARD} IN_LIST CMAKE_CXX_COMPILER_IMPORT_STD) - set(CMAKE_CXX_MODULE_STD ON) - message(STATUS "CMAKE_CXX_MODULE_STD=${CMAKE_CXX_MODULE_STD}") -endif() +set(TARGET_NAME beman.execution_headers) # used in src, and docs +set(TARGET_NAMESPACE beman) # TODO(CK): still used in docs, is this really needed? +set(TARGET_PREFIX ${PROJECT_NAME}) # NOTE: used in src, and docs? +set(TARGETS_EXPORT_NAME ${PROJECT_NAME}-targets) # NOTE: must be set, is important for installation! CK -if(CMAKE_CXX_SCAN_FOR_MODULES AND ${CMAKE_GENERATOR} STREQUAL Ninja) - set(BEMAN_USE_MODULES ON) - message(STATUS "BEMAN_USE_MODULES=${BEMAN_USE_MODULES}") -else() - message(WARNING "Missing support for CMAKE_CXX_SCAN_FOR_MODULES!") -endif() +#=============================================================================== +if(BEMAN_USE_MODULES) + set(CMAKE_CXX_VISIBILITY_PRESET hidden) + set(CMAKE_VISIBILITY_INLINES_HIDDEN TRUE) + + # CMake requires the language standard to be specified as compile feature + # when a target provides C++23 modules and the target will be installed + add_library(beman.execution STATIC) + add_library(beman::execution ALIAS beman.execution) + target_compile_features( + beman.execution + PUBLIC cxx_std_${CMAKE_CXX_STANDARD} + ) -# gersemi: off -if(CMAKE_EXPORT_COMPILE_COMMANDS) - set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}) - message( - STATUS - "CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES=${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}" + include(GenerateExportHeader) + + generate_export_header( + beman.execution + BASE_NAME beman.execution + EXPORT_FILE_NAME beman/execution/modules_export.hpp ) + target_sources( + beman.execution + PUBLIC + FILE_SET HEADERS + BASE_DIRS include ${CMAKE_CURRENT_BINARY_DIR} + FILES + ${CMAKE_CURRENT_BINARY_DIR}/beman/execution/modules_export.hpp + ) + # FIXME: target_compile_definitions(beman.execution PUBLIC BEMAN_HAS_MODULES) endif() -# gersemi: on - -# CMake requires the language standard to be specified as compile feature -# when a target provides C++23 modules and the target will be installed -add_library(${TARGET_NAME} STATIC) -target_compile_features(${TARGET_NAME} PUBLIC cxx_std_23) if(BEMAN_USE_MODULES AND CMAKE_CXX_MODULE_STD) - target_compile_definitions(${TARGET_NAME} PUBLIC BEMAN_HAS_IMPORT_STD) + target_compile_definitions(beman.execution PUBLIC BEMAN_HAS_IMPORT_STD) else() message(WARNING "Missing support for CMAKE_CXX_MODULE_STD!") endif() @@ -86,17 +70,12 @@ option( ${PROJECT_IS_TOP_LEVEL} ) -option( - BEMAN_EXECUTION_ENABLE_INSTALL - "Install the project components. Values: { ON, OFF }." - ${PROJECT_IS_TOP_LEVEL} -) - -include(GNUInstallDirs) -set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) - add_subdirectory(src/beman/execution) +# NOTE: this must be done before tests! CK +include(./cmake/beman-install-library-config.cmake) +beman_install_library(${TARGET_PREFIX} headers) + if(BEMAN_EXECUTION_ENABLE_TESTING) enable_testing() @@ -107,31 +86,3 @@ if(BEMAN_EXECUTION_BUILD_EXAMPLES) add_subdirectory(examples) add_subdirectory(docs/code) endif() - -if(NOT BEMAN_EXECUTION_ENABLE_INSTALL OR CMAKE_SKIP_INSTALL_RULES) - return() -endif() - -include(CMakePackageConfigHelpers) - -write_basic_package_version_file( - ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PACKAGE_NAME}-version.cmake - VERSION ${CMAKE_PROJECT_VERSION} - COMPATIBILITY AnyNewerVersion -) - -configure_package_config_file( - "cmake/Config.cmake.in" - ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PACKAGE_NAME}.cmake - INSTALL_DESTINATION ${INSTALL_CONFIGDIR} -) - -install( - FILES - ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PACKAGE_NAME}.cmake - ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PACKAGE_NAME}-version.cmake - DESTINATION ${INSTALL_CONFIGDIR} -) - -set(CPACK_GENERATOR TGZ) -include(CPack) diff --git a/CMakePresets.json b/CMakePresets.json index b56d96e6..5bc75f84 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -9,7 +9,7 @@ "cacheVariables": { "CMAKE_CXX_STANDARD": "23", "CMAKE_CXX_EXTENSIONS": true, - "CMAKE_CXX_SCAN_FOR_MODULES": false, + "CMAKE_CXX_SCAN_FOR_MODULES": true, "CMAKE_CXX_STANDARD_REQUIRED": true, "CMAKE_EXPORT_COMPILE_COMMANDS": true, "CMAKE_SKIP_TEST_ALL_DEPENDENCY": false, @@ -61,7 +61,7 @@ "_debug-base" ], "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": "infra/cmake/llvm-toolchain.cmake" + "CMAKE_TOOLCHAIN_FILE": "infra/cmake/llvm-libc++-toolchain.cmake" } }, { @@ -72,7 +72,7 @@ "_release-base" ], "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": "infra/cmake/llvm-toolchain.cmake" + "CMAKE_TOOLCHAIN_FILE": "infra/cmake/llvm-libc++-toolchain.cmake" } }, { @@ -83,6 +83,7 @@ "_debug-base" ], "cacheVariables": { + "CMAKE_CXX_SCAN_FOR_MODULES": false, "CMAKE_TOOLCHAIN_FILE": "infra/cmake/appleclang-toolchain.cmake" } }, @@ -94,6 +95,7 @@ "_release-base" ], "cacheVariables": { + "CMAKE_CXX_SCAN_FOR_MODULES": false, "CMAKE_TOOLCHAIN_FILE": "infra/cmake/appleclang-toolchain.cmake" } }, diff --git a/Makefile b/Makefile index 825c9daf..768395d0 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ EXAMPLE = beman.execution.examples.stop_token ################################################ ifeq (${hostSystemName},Darwin) - export LLVM_PREFIX:=$(shell brew --prefix llvm) + export LLVM_PREFIX:=$(shell brew --prefix llvm) export LLVM_DIR:=$(shell realpath ${LLVM_PREFIX}) export PATH:=${LLVM_DIR}/bin:${PATH} @@ -52,12 +52,14 @@ ifeq (${hostSystemName},Darwin) # export GCOV="llvm-cov gcov" ### TODO: to test g++-15: - export GCC_PREFIX:=$(shell brew --prefix gcc) - export GCC_DIR:=$(shell realpath ${GCC_PREFIX}) - - export CMAKE_CXX_STDLIB_MODULES_JSON=${GCC_DIR}/lib/gcc/current/libstdc++.modules.json - # export CXX:=g++-15 - # export CXXFLAGS:=-stdlib=libstdc++ + # export GCC_PREFIX:=$(shell brew --prefix gcc) + # export GCC_DIR:=$(shell realpath ${GCC_PREFIX}) + + # XXX export CMAKE_CXX_STDLIB_MODULES_JSON=${GCC_DIR}/lib/gcc/current/libstdc++.modules.json + ifeq ($(CXX),) + export CXX=g++-15 + export CXXFLAGS=-stdlib=libstdc++ + endif export GCOV="gcov" else ifeq (${hostSystemName},Linux) export LLVM_DIR=/usr/lib/llvm-20 @@ -97,7 +99,7 @@ endif # TODO: beman.execution.examples.modules # FIXME: beman.execution.execution-module.test beman.execution.stop-token-module.test -default: test +default: release all: $(SANITIZERS) @@ -111,15 +113,22 @@ doc: # $(SANITIZERS): # $(MAKE) SANITIZER=$@ +# ========================================================== +# NOTE: cmake configure to only test without modules! CK +# ========================================================== build: - cmake --fresh -G Ninja -S $(SOURCEDIR) -B $(BUILD) $(TOOLCHAIN) $(SYSROOT) \ + cmake -G Ninja -S $(SOURCEDIR) -B $(BUILD) $(TOOLCHAIN) $(SYSROOT) \ -D CMAKE_EXPORT_COMPILE_COMMANDS=ON \ -D CMAKE_SKIP_INSTALL_RULES=ON \ -D CMAKE_CXX_STANDARD=23 \ -D CMAKE_CXX_EXTENSIONS=ON \ -D CMAKE_CXX_STANDARD_REQUIRED=ON \ - -D CMAKE_CXX_COMPILER=$(CXX) # XXX -D CMAKE_CXX_FLAGS="$(CXX_FLAGS) $(SAN_FLAGS)" + -D CMAKE_CXX_SCAN_FOR_MODULES=OFF \ + -D BEMAN_USE_MODULES=OFF \ + -D CMAKE_BUILD_TYPE=Release \ + -D CMAKE_CXX_COMPILER=$(CXX) --log-level=VERBOSE cmake --build $(BUILD) +# XXX --fresh -D CMAKE_CXX_FLAGS="$(CXX_FLAGS) $(SAN_FLAGS)" # NOTE: without install, see CMAKE_SKIP_INSTALL_RULES! CK test: build @@ -131,11 +140,13 @@ install: test CMakeUserPresets.json:: cmake/CMakeUserPresets.json ln -s $< $@ +# ========================================================== release: CMakeUserPresets.json cmake --preset $@ --log-level=TRACE # XXX --fresh ln -fs $(BUILDROOT)/$@/compile_commands.json . cmake --workflow --preset $@ +# ========================================================== debug: CMakeUserPresets.json cmake --preset $@ --log-level=TRACE # XXX --fresh ln -fs $(BUILDROOT)build/$@/compile_commands.json . @@ -165,8 +176,11 @@ clang-tidy: $(BUILD)/compile_commands.json codespell: pre-commit run $@ +# ========================================================== format: + pre-commit autoupdate pre-commit run --all +# ========================================================== cmake-format: pre-commit run gersemi diff --git a/README.md b/README.md index 5f22e037..7b13e7e7 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ contains some links for general information about the sender/receivers and `std: ## Preconditions - cmake v3.30 or newer -- ninja v1.11.1 or newer +- ninja v1.13.0 or newer - A compiler that supports at least C++23 diff --git a/bin/mk-module.py b/bin/mk-module.py new file mode 100755 index 00000000..ddad4234 --- /dev/null +++ b/bin/mk-module.py @@ -0,0 +1,269 @@ +#!/usr/bin/python3 +# bin/mk-module.py +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +import glob +import inspect +import os +import re +import sys + +head_re = re.compile("include/(?P.*)\.hpp") + + +def make_loc(file, number): + loc = {} + loc["number"] = number + loc["file"] = file + return loc + + +class common_writer: + def write(self, loc, line): + self.do_write(loc, line) + + def write_same(self, line): + self.do_write(self.loc, line) + + def write_next(self, line): + self.do_next() + self.do_write(self.do_get_loc(), line) + + +def clean_name(file): + match = head_re.match(file) + return match.group("name") + + +top = [] +for toplevel in glob.glob("include/?eman/*/*.hpp"): + top.append(clean_name(toplevel)) + +all = top.copy() +for detail in glob.glob("include/?eman/*/?etail/*.hpp"): + all.append(clean_name(detail)) + +headers = {} +beman_re = re.compile('#include ["<](?P[bB]eman/.*)\.hpp[">]') +other_re = re.compile('#include ["<](?P.*)[">]') + + +class comment_writer(common_writer): + comment_re = re.compile("(.*)/\*.*\*/(.*)") + export_re = re.compile(".*export.*") + start_re = re.compile("(.*)/\*.*") + end_re = re.compile(".*\*/\s*(.*)") + + def __init__(self, to): + self.to = to + self.in_comment = False + + def do_get_loc(self): + return self.to.do_get_loc() + + def do_next(self): + self.to.do_next() + + def do_write(self, loc, line): + if self.in_comment: + match = self.end_re.match(line) + if match: + self.in_comment = False + self.to.write(loc, match.group(1)) + return + match = self.comment_re.match(line) + if match: + if not self.export_re.match(match.group(1)): + self.to.write(loc, (match.group(1) + " " + match.group(2)).rstrip()) + else: + self.to.write(loc, line) + return + match = self.start_re.match(line) + if match: + self.in_comment = True + line = match.group(1).rstrip() + self.to.write(loc, line) + + +class filter_writer(common_writer): + included_re = re.compile(".*INCLUDED_BEMAN.*") + file_re = re.compile("// include/beman\S*\s*-.-C..-.-") + spdx_re = re.compile(".*SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception.*") + namespace_re = re.compile(".*// namespace.*") + nolint_re = re.compile(".*// NOLINT.*") + comment_re = re.compile("(.*)//.*") + close_re = re.compile("^\s*}\s*$") + public_re = re.compile("^\s*public:\s*$") + else_re = re.compile("^\s*#\s*else\s*$") + + def __init__(self, to): + self.to = to + self.previous_line_empty = False + + def do_get_loc(self): + return self.to.do_get_loc() + + def do_next(self): + self.to.do_next() + + def include_this_line(self, line): + return ( + not beman_re.match(line) + and not other_re.match(line) + and not self.included_re.match(line) + and not self.file_re.match(line) + and not self.spdx_re.match(line) + ) + + def do_write(self, loc, line): + if not self.include_this_line(line): + return + match = self.comment_re.match(line) + if ( + match + and not self.namespace_re.match(line) + and not self.nolint_re.match(line) + ): + line = match.group(1).rstrip() + if line != "" or not self.previous_line_empty: + self.previous_line_empty = ( + (line == "") + or (self.close_re.match(line) is not None) + or (self.public_re.match(line) is not None) + or (self.else_re.match(line) is not None) + ) + self.to.write(loc, line) + + +def get_dependencies(component): + deps = [] + with open("include/" + component + ".hpp") as file: + for line in file.readlines(): + if beman_re.match(line): + deps.append(beman_re.match(line).group("name")) + elif other_re.match(line): + header = other_re.match(line).group("name") + if header not in headers: + headers[header] = 1 + + return deps + + +dependencies = {} + +for component in all: + dependencies[component] = get_dependencies(component) + +if len(sys.argv) != 2: + print(f"usage: {sys.argv[0]} ") + sys.exit(1) + +module_file = sys.argv[1] + +project_re = re.compile("(?P(?P[bB]eman)/.*)/") +define_re = re.compile("#define") +export_re = re.compile("BEMAN_EXECUTION_EXPORT (.*)") + + +def write_header(to, header): + filename = f"include/{header}.hpp" + with open(filename) as file: + number = 0 + for line in file.readlines(): + number += 1 + match = export_re.match(line) + loc = make_loc(filename, number) + if match: + to.write(loc, f"export /* --------- */ {match.group(1)}") + else: + to.write(loc, line.rstrip()) + + +deps = {} + + +def build_header(file, header): + todo = dependencies[header].copy() + while 0 < len(todo): + if not todo[0] in deps: + deps[todo[0]] = dependencies[todo[0]].copy() + for new in dependencies[todo[0]]: + todo.append(new) + todo = todo[1:] + + +class file_writer(common_writer): + def __init__(self, to): + self.first_line = True + self.to = to + self.loc = make_loc("", 0) + + def do_get_loc(self): + return self.loc + + def do_next(self): + self.loc["number"] += 1 + + def do_write(self, loc, line): + if not self.first_line and ( + loc["file"] != self.loc["file"] or loc["number"] != self.loc["number"] + ): + self.to.write(f"#line {loc['number']} \"{loc['file']}\"\n") + self.to.write(f"{line}\n") + self.loc = loc + self.loc["number"] += 1 + self.first_line = False + + +with open(module_file, "w") as file: + file_to = file_writer(file) + to = filter_writer(file_to) + to = comment_writer(to) + + file_to.write(make_loc(sys.argv[0], inspect.currentframe().f_lineno), "module;") + file_to.write_next("// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception") + file_to.write_next("// *****************************************************;") + file_to.write_next("// *** WARNING: this file is generated: do not edit! ***;") + file_to.write_next("// *****************************************************;") + file_to.write_next(f"// generated by {sys.argv[0]} {sys.argv[1]}") + file_to.write_next("") + file_to.write_next("#include ") + file_to.write_next("#include ") + file_to.write_next("") + file_to.write_next("#ifdef BEMAN_HAS_IMPORT_STD") + file_to.write_next("import std;") + file_to.write_next("#else") + includes = list(headers.keys()) + for include in sorted(includes): + file_to.write( + make_loc(sys.argv[0], inspect.currentframe().f_lineno), + f"#include <{include}>", + ) + file_to.write_next("#endif") + file_to.write_next("") + file_to.write_next("export module beman.execution;") + file_to.write_next("") + + for header in top: + if re.match(".*execution26.*", header): + continue + + prolog_done = False + filename = f"include/{header}.hpp" + with open(filename) as file: + number = 0 + for line in file.readlines(): + number += 1 + if not prolog_done and define_re.match(line): + prolog_done = True + to.write(make_loc(filename, number), "") + build_header(file, header) + to.write_next("") + + while 0 < len(deps): + empty = [item for item in deps.keys() if 0 == len(deps[item])] + for e in empty: + write_header(to, e) + deps.pop(e, None) + for d in deps.keys(): + deps[d] = [item for item in deps[d] if e != item] diff --git a/cmake/beman-install-library-config.cmake b/cmake/beman-install-library-config.cmake new file mode 100644 index 00000000..4ad27ff2 --- /dev/null +++ b/cmake/beman-install-library-config.cmake @@ -0,0 +1,251 @@ +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +include_guard(GLOBAL) + +# This file defines the function `beman_install_library` which is used to +# install a library target and its headers, along with optional CMake +# configuration files. +# +# The function is designed to be reusable across different Beman libraries. + +function(beman_install_library name interface) + # Usage + # ----- + # + # beman_install_library(NAME INTERFACE) + # + # Brief + # ----- + # + # This function installs the specified library target and its headers. + # It also handles the installation of the CMake configuration files if needed. + # + # CMake variables + # --------------- + # + # Note that configuration of the installation is generally controlled by CMake + # cache variables so that they can be controlled by the user or tool running the + # `cmake` command. Neither `CMakeLists.txt` nor `*.cmake` files should set these + # variables directly. + # + # - BEMAN_INSTALL_CONFIG_FILE_PACKAGES: + # List of packages that require config file installation. + # If the package name is in this list, it will install the config file. + # + # - _INSTALL_CONFIG_FILE_PACKAGE: + # Boolean to control config file installation for the specific library. + # The prefix `` is the uppercased name of the library with dots + # replaced by underscores. + # + + # if(NOT TARGET "${name}") + # message(FATAL_ERROR "Target '${name}' does not exist.") + # endif() + + # if(NOT ARGN STREQUAL "") + # message( + # FATAL_ERROR + # "beman_install_library does not accept extra arguments: ${ARGN}" + # ) + # endif() + + # Given foo.bar, the component name is bar + string(REPLACE "." ";" name_parts "${name}") + # fail if the name doesn't look like foo.bar + list(LENGTH name_parts name_parts_length) + if(NOT name_parts_length EQUAL 2) + message( + FATAL_ERROR + "beman_install_library expects a name of the form 'beman.', got '${name}'" + ) + endif() + + set(target_name "${name}") + + # COMPONENT + # Specify an installation component name with which the install rule is associated, + # such as Runtime or Development. + set(install_component_name "${name}") # TODO(CK): this is not common name! + + set(export_name "${name}") + set(package_name "${name}") + list(GET name_parts -1 component_name) + + include(GNUInstallDirs) + + set(package_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${package_name}") + + set(target_list) + if(TARGET "${target_name}") + set_target_properties( + "${target_name}" + PROPERTIES EXPORT_NAME "${component_name}" + ) + message( + VERBOSE + "beman-install-library: COMPONENT ${component_name} for TARGET '${target_name}'" + ) + list(APPEND target_list "${target_name}") + + get_target_property( + INTERFACE_CXX_MODULE_SETS + ${target_name} + INTERFACE_CXX_MODULE_SETS + ) + if(INTERFACE_CXX_MODULE_SETS) + message( + VERBOSE + "beman-install-library: '${target_name}' has INTERFACE_CXX_MODULE_SETS=${INTERFACE_CXX_MODULE_SETS}" + ) + set(__INSTALL_CXX_MODULES + FILE_SET + ${INTERFACE_CXX_MODULE_SETS} + DESTINATION + ${package_install_dir}/modules + ) + endif() + endif() + + if(interface AND TARGET "${target_name}_${interface}") + set_target_properties( + "${target_name}_${interface}" + PROPERTIES EXPORT_NAME "${component_name}_${interface}" + ) + message( + VERBOSE + "beman-install-library: COMPONENT ${component_name} for TARGET '${name}_${interface}'" + ) + list(APPEND target_list "${target_name}_${interface}") + + get_target_property( + INTERFACE_HEADER_SETS + ${target_name}_${interface} + INTERFACE_HEADER_SETS + ) + if(INTERFACE_HEADER_SETS) + message( + VERBOSE + "beman-install-library: '${target_name}_${interface}' has INTERFACE_HEADER_SETS=${INTERFACE_HEADER_SETS}" + ) + set(__INSTALL_HEADER_SETS FILE_SET ${INTERFACE_HEADER_SETS}) + endif() + endif() + + if(CMAKE_SKIP_INSTALL_RULES) + message( + WARNING + "beman-install-library: not installing targets '${target_list}' due to CMAKE_SKIP_INSTALL_RULES" + ) + return() + endif() + + # ============================================================ + install( + TARGETS ${target_list} + COMPONENT "${install_component_name}" + EXPORT "${export_name}" + FILE_SET HEADERS + ${__INSTALL_HEADER_SETS} + # FILE_SET CXX_MODULES + # DESTINATION ${package_install_dir}/modules + ${__INSTALL_CXX_MODULES} + # There's currently no convention for this location + CXX_MODULES_BMI + DESTINATION + ${package_install_dir}/bmi-${CMAKE_CXX_COMPILER_ID}_$ + ) + # ============================================================ + + # Determine the prefix for project-specific variables + string(TOUPPER "${name}" project_prefix) + string(REPLACE "." "_" project_prefix "${project_prefix}") + + option( + ${project_prefix}_INSTALL_CONFIG_FILE_PACKAGE + "Enable creating and installing a CMake config-file package. Default: ON. Values: { ON, OFF }." + ON + ) + + # By default, install the config package + set(install_config_package ON) + + # Turn OFF installation of config package by default if, + # in order of precedence: + # 1. The specific package variable is set to OFF + # 2. The package name is not in the list of packages to install config files + if(DEFINED BEMAN_INSTALL_CONFIG_FILE_PACKAGES) + if( + NOT "${install_component_name}" + IN_LIST + BEMAN_INSTALL_CONFIG_FILE_PACKAGES + ) + set(install_config_package OFF) + endif() + endif() + if(DEFINED ${project_prefix}_INSTALL_CONFIG_FILE_PACKAGE) + set(install_config_package + ${${project_prefix}_INSTALL_CONFIG_FILE_PACKAGE} + ) + endif() + + if(install_config_package) + message( + VERBOSE + "beman-install-library: Export cmake config to ${package_install_dir} for '${name}'" + ) + + include(CMakePackageConfigHelpers) + + find_file( + config_file_template + NAMES "${package_name}-config.cmake.in" + PATHS "${PROJECT_SOURCE_DIR}/cmake" + NO_DEFAULT_PATH + NO_CACHE + REQUIRED + ) + set(config_package_file + "${CMAKE_CURRENT_BINARY_DIR}/${package_name}-config.cmake" + ) + configure_package_config_file( + "${config_file_template}" + "${config_package_file}" + INSTALL_DESTINATION "${package_install_dir}" + PATH_VARS PROJECT_NAME PROJECT_VERSION + ) + + set(config_version_file + "${CMAKE_CURRENT_BINARY_DIR}/${package_name}-config-version.cmake" + ) + write_basic_package_version_file( + "${config_version_file}" + VERSION "${PROJECT_VERSION}" + COMPATIBILITY ExactVersion + ) + + install( + FILES "${config_package_file}" "${config_version_file}" + DESTINATION "${package_install_dir}" + COMPONENT "${install_component_name}" + ) + + # NOTE: must be same value as ${TARGETS_EXPORT_NAME}.cmake! CK + set(config_targets_file "${package_name}-targets.cmake") + install( + EXPORT "${export_name}" + DESTINATION "${package_install_dir}" + NAMESPACE beman:: + FILE "${config_targets_file}" + CXX_MODULES_DIRECTORY + cxx-modules + COMPONENT "${install_component_name}" + ) + else() + message( + WARNING + "beman-install-library: Not installing a config package for '${name}'" + ) + endif() +endfunction() + +set(CPACK_GENERATOR TGZ) +include(CPack) diff --git a/cmake/Config.cmake.in b/cmake/beman.execution-config.cmake.in similarity index 100% rename from cmake/Config.cmake.in rename to cmake/beman.execution-config.cmake.in diff --git a/cmake/cxx-modules-rules.cmake b/cmake/cxx-modules-rules.cmake new file mode 100644 index 00000000..498131d1 --- /dev/null +++ b/cmake/cxx-modules-rules.cmake @@ -0,0 +1,154 @@ +# +# A CMake language file to be included as the last step of all project() command calls. +# This file must be included/used as CMAKE_PROJECT_INCLUDE -> after project() +# + +# ---- The include guard applies within the current directory and below ---- +include_guard(DIRECTORY) + +if(NOT PROJECT_NAME) + message( + FATAL_ERROR + "This CMake file has to be included as the last step of all project() command calls!" + ) +endif() + +# Use modules? default NO! +if(NOT DEFINED CMAKE_CXX_SCAN_FOR_MODULES) + set(CMAKE_CXX_SCAN_FOR_MODULES OFF) +endif() + +# Control whether the test target depends on the all target. +set(CMAKE_SKIP_TEST_ALL_DEPENDENCY OFF) + +# gersemi: off +option(CMAKE_EXPORT_COMPILE_COMMANDS "Prepare run-clang-tidy" ${PROJECT_IS_TOP_LEVEL}) +if(CMAKE_EXPORT_COMPILE_COMMANDS) + message( + STATUS + "CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES=${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}" + ) + set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}) +endif() +# gersemi: on + +# Ensure non-empty default build type for single-config +get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(NOT isMultiConfig) + set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type") +endif() +set(CMAKE_DEBUG_POSTFIX _d) + +# ------------------------------------------------------------------------------ +# This property setting also needs to be consistent between the installed shared +# library and its consumer, otherwise most toolchains will once again reject the +# consumer's generated BMI. +# ------------------------------------------------------------------------------ +if(NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 23) +endif() + +# Neither of these two are technically needed, but they make the expectation clear +set(CMAKE_CXX_EXTENSIONS ON) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# NOTE: only with Ninja generator install of bmi files works yet! +if(CMAKE_GENERATOR MATCHES "Ninja") + if( + CMAKE_CXX_COMPILER_ID STREQUAL "Clang" + AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0 + ) + set(CMAKE_CXX_SCAN_FOR_MODULES ON) + + if(NOT LINUX) + string(APPEND CMAKE_CXX_MODULE_MAP_FLAG " -fmodules-reduced-bmi") + endif() + + add_compile_options($ENV{CXXFLAGS}) + add_link_options($ENV{CXXFLAGS}) + elseif( + CMAKE_CXX_COMPILER_ID STREQUAL "GNU" + AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 15.0 + ) + set(CMAKE_CXX_SCAN_FOR_MODULES ON) + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + set(CMAKE_CXX_SCAN_FOR_MODULES ON) + else() + set(CMAKE_CXX_SCAN_FOR_MODULES OFF) + endif() +endif() + +if(CMAKE_CXX_STDLIB_MODULES_JSON) + message( + STATUS + "CMAKE_CXX_STDLIB_MODULES_JSON=${CMAKE_CXX_STDLIB_MODULES_JSON}" + ) +endif() + +if(NOT DEFINED CMAKE_CXX_MODULE_STD) + set(CMAKE_CXX_MODULE_STD OFF) +endif() + +option( + BEMAN_USE_STD_MODULE + "Check if 'import std;' is possible with the toolchain?" + OFF +) +message(STATUS "BEMAN_USE_STD_MODULE=${BEMAN_USE_STD_MODULE}") + +if(BEMAN_USE_STD_MODULE) + # ------------------------------------------------------------------------- + # Tell CMake that we explicitly want `import std`. + # This will initialize the property on all targets declared after this to 1 + # ------------------------------------------------------------------------- + message( + STATUS + "CMAKE_CXX_COMPILER_IMPORT_STD=${CMAKE_CXX_COMPILER_IMPORT_STD}" + ) + if(${CMAKE_CXX_STANDARD} IN_LIST CMAKE_CXX_COMPILER_IMPORT_STD) + set(CMAKE_CXX_MODULE_STD ON) + set(CMAKE_CXX_SCAN_FOR_MODULES ON) + option( + BEMAN_HAS_IMPORT_STD + "Build with import std; is possible and used!" + ${CMAKE_CXX_MODULE_STD} + ) + message(STATUS "CMAKE_CXX_MODULE_STD=${CMAKE_CXX_MODULE_STD}") + else() + set(CMAKE_CXX_MODULE_STD OFF) + message(WARNING "CMAKE_CXX_MODULE_STD=${CMAKE_CXX_MODULE_STD}") + endif() + message(STATUS "BEMAN_HAS_IMPORT_STD=${BEMAN_HAS_IMPORT_STD}") +endif() + +if(CMAKE_CXX_STANDARD GREATER_EQUAL 20) + option(BEMAN_USE_MODULES "Build CXX_MODULES" ${CMAKE_CXX_SCAN_FOR_MODULES}) +endif() +message(STATUS "BEMAN_USE_MODULES=${BEMAN_USE_MODULES}") + +if(NOT BEMAN_USE_MODULES) + set(CMAKE_CXX_SCAN_FOR_MODULES OFF) +endif() +message(STATUS "CMAKE_CXX_SCAN_FOR_MODULES=${CMAKE_CXX_SCAN_FOR_MODULES}") + +# ------------------------------------------------------------------------------ +# Avoid creating CMAKE_..._OUTPUT_DIRECTORY as cache variables, they should not +# be under the control of the developer. They should be controlled by the +# project because parts of the project may make assumptions about the relative +# layout of the binaries. More importantly, leaving them as ordinary variables +# also means they can be unset within subdirectories where test executables are +# defined, allowing them to avoid being collected with the other main binaries +# and cluttering up that area. +# ------------------------------------------------------------------------------ +set(stageDir ${CMAKE_CURRENT_BINARY_DIR}/stagedir) +include(GNUInstallDirs) + +if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${stageDir}/${CMAKE_INSTALL_BINDIR}) +endif() +if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${stageDir}/${CMAKE_INSTALL_LIBDIR}) +endif() +if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${stageDir}/${CMAKE_INSTALL_LIBDIR}) +endif() diff --git a/cmake/prelude.cmake b/cmake/prelude.cmake new file mode 100644 index 00000000..c7b86338 --- /dev/null +++ b/cmake/prelude.cmake @@ -0,0 +1,114 @@ +# +# This file must be included/used as CMAKE_PROJECT_TOP_LEVEL_INCLUDES -> before project() is called! +# + +# ---- The include guard applies globally to the whole build ---- +include_guard(GLOBAL) + +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) + message( + FATAL_ERROR + "In-source builds are not supported. " + "Please read the BUILDING document before trying to build this project. " + "You may need to delete 'CMakeCache.txt' and 'CMakeFiles/' first." + ) +endif() + +if(PROJECT_NAME) + message( + FATAL_ERROR + "This CMake file has to be included before first project() command call!" + ) +endif() + +# gersemi: off +# --------------------------------------------------------------------------- +# use ccache if found +# --------------------------------------------------------------------------- +find_program(CCACHE_EXECUTABLE "ccache" HINTS /usr/local/bin /opt/local/bin) +if(CCACHE_EXECUTABLE) + message(STATUS "use ccache") + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}" CACHE PATH "ccache") + set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}" CACHE PATH "ccache") +endif() + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +# --------------------------------------------------------------------------- +# check if import std; is supported by CMAKE_CXX_COMPILER +# --------------------------------------------------------------------------- +if(CMAKE_VERSION VERSION_GREATER_EQUAL 4.2) + set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "d0edc3af-4c50-42ea-a356-e2862fe7a444") +endif() +# gersemi: on + +# FIXME: on APPLE with clang++ still needs to export CXX=clang++ +if("$ENV{CXX}" STREQUAL "" AND CMAKE_CXX_COMPILER) + message(WARNING "\$CXX is not set") + set(ENV{CXX} ${CMAKE_CXX_COMPILER}) +endif() + +# --------------------------------------------------------------------------- +# Workaround needed for CMAKE and clang++ to find the libc++.modules.json file +# --------------------------------------------------------------------------- +if( + CMAKE_VERSION VERSION_GREATER_EQUAL 4.2 + AND ("$ENV{CXX}" MATCHES "clang" OR CMAKE_CXX_COMPILER MATCHES "clang") +) + # NOTE: Always use libc++ + # see https://releases.llvm.org/19.1.0/projects/libcxx/docs/index.html + set(ENV{CXXFLAGS} -stdlib=libc++) + message(STATUS "CXXFLAGS=-stdlib=libc++") + + if(APPLE) + execute_process( + OUTPUT_VARIABLE LLVM_PREFIX + COMMAND brew --prefix llvm + COMMAND_ECHO STDOUT + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + file(REAL_PATH ${LLVM_PREFIX} LLVM_DIR) + set(LLVM_DIR ${LLVM_DIR} CACHE FILEPATH "") + + message(STATUS "LLVM_DIR=${LLVM_DIR}") + add_link_options(-L${LLVM_DIR}/lib/c++) + include_directories(SYSTEM ${LLVM_DIR}/include) + + set(CMAKE_CXX_STDLIB_MODULES_JSON + ${LLVM_DIR}/lib/c++/libc++.modules.json + ) + elseif(LINUX) + execute_process( + OUTPUT_VARIABLE LLVM_MODULES + COMMAND clang++ -print-file-name=c++/libc++.modules.json + COMMAND_ECHO STDOUT + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(NOT CMAKE_CXX_STDLIB_MODULES_JSON) + set(CMAKE_CXX_STDLIB_MODULES_JSON ${LLVM_MODULES}) + endif() + message( + STATUS + "CMAKE_CXX_STDLIB_MODULES_JSON=${CMAKE_CXX_STDLIB_MODULES_JSON}" + ) + endif() + + if(EXISTS ${CMAKE_CXX_STDLIB_MODULES_JSON}) + message( + STATUS + "CMAKE_CXX_STDLIB_MODULES_JSON=${CMAKE_CXX_STDLIB_MODULES_JSON}" + ) + # gersemi: off + set(CACHE{CMAKE_CXX_STDLIB_MODULES_JSON} + TYPE FILEPATH + HELP "Result of: clang++ -print-file-name=c++/libc++.modules.json" + VALUE ${CMAKE_CXX_STDLIB_MODULES_JSON} + ) + # gersemi: on + else() + message( + WARNING + "File does NOT EXISTS! ${CMAKE_CXX_STDLIB_MODULES_JSON}" + ) + endif() +endif() diff --git a/cmake/presets/CMakeDarwinPresets.json b/cmake/presets/CMakeDarwinPresets.json index 04528268..8ce5fb03 100644 --- a/cmake/presets/CMakeDarwinPresets.json +++ b/cmake/presets/CMakeDarwinPresets.json @@ -8,7 +8,6 @@ "name": "debug-base-Darwin", "hidden": true, "cacheVariables": { - "CMAKE_CXX_STDLIB_MODULES_JSON": "$env{CMAKE_CXX_STDLIB_MODULES_JSON}", "CMAKE_BUILD_TYPE": "Debug" }, "condition": { @@ -21,7 +20,6 @@ "name": "release-base-Darwin", "hidden": true, "cacheVariables": { - "CMAKE_CXX_STDLIB_MODULES_JSON": "$env{CMAKE_CXX_STDLIB_MODULES_JSON}", "CMAKE_BUILD_TYPE": "RelWithDebInfo" }, "condition": { diff --git a/cmake/presets/CMakeGenericPresets.json b/cmake/presets/CMakeGenericPresets.json index 826484cc..df2d2045 100644 --- a/cmake/presets/CMakeGenericPresets.json +++ b/cmake/presets/CMakeGenericPresets.json @@ -1,5 +1,5 @@ { - "version": 6, + "version": 9, "configurePresets": [ { "name": "root-config", @@ -17,6 +17,7 @@ "CMAKE_CXX_SCAN_FOR_MODULES": true, "CMAKE_CXX_STANDARD_REQUIRED": true, "CMAKE_EXPORT_COMPILE_COMMANDS": true, + "CMAKE_INSTALL_MESSAGE": "LAZY", "CMAKE_SKIP_TEST_ALL_DEPENDENCY": false }, "warnings": { diff --git a/cmake/presets/CMakeLinuxPresets.json b/cmake/presets/CMakeLinuxPresets.json index 61f9b24a..73716857 100644 --- a/cmake/presets/CMakeLinuxPresets.json +++ b/cmake/presets/CMakeLinuxPresets.json @@ -1,5 +1,5 @@ { - "version": 6, + "version": 9, "include": [ "CMakeGenericPresets.json" ], @@ -8,7 +8,6 @@ "name": "debug-base-Linux", "hidden": true, "cacheVariables": { - "CMAKE_CXX_STDLIB_MODULES_JSON": "$env{CMAKE_CXX_STDLIB_MODULES_JSON}", "CMAKE_BUILD_TYPE": "Debug" }, "condition": { @@ -21,7 +20,6 @@ "name": "release-base-Linux", "hidden": true, "cacheVariables": { - "CMAKE_CXX_STDLIB_MODULES_JSON": "$env{CMAKE_CXX_STDLIB_MODULES_JSON}", "CMAKE_BUILD_TYPE": "RelWithDebInfo" }, "condition": { diff --git a/cmake/presets/CMakeWindowsPresets.json b/cmake/presets/CMakeWindowsPresets.json index d8834f2c..6ab8f1cf 100644 --- a/cmake/presets/CMakeWindowsPresets.json +++ b/cmake/presets/CMakeWindowsPresets.json @@ -1,5 +1,5 @@ { - "version": 6, + "version": 9, "include": [ "CMakeGenericPresets.json" ], diff --git a/docs/code/CMakeLists.txt b/docs/code/CMakeLists.txt index 2d2752d3..21b13180 100644 --- a/docs/code/CMakeLists.txt +++ b/docs/code/CMakeLists.txt @@ -3,11 +3,11 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # gersemi: on -list(APPEND EXAMPLES) +set(EXAMPLES) -if(BEMAN_USE_MODULES) - list(APPEND EXAMPLES modules) # modules.cpp -endif() +# if(BEMAN_USE_MODULES) +# list(APPEND EXAMPLES modules) # modules.cpp +# endif() foreach(EXAMPLE ${EXAMPLES}) set(EXAMPLE_TARGET ${TARGET_PREFIX}.tutorial.${EXAMPLE}) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index baa1019e..71ffabca 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -3,8 +3,21 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # gersemi: on -list( - APPEND EXAMPLES +cmake_minimum_required(VERSION 3.30...4.2) + +include(../cmake/prelude.cmake) + +project(beman_execution.example LANGUAGES CXX) + +if(PROJECT_IS_TOP_LEVEL) + include(../cmake/cxx-modules-rules.cmake) + + find_package(beman.execution 0.2.0 EXACT REQUIRED) + + enable_testing() +endif() + +set(EXAMPLES stackoverflow inspect playground @@ -26,11 +39,16 @@ if(BEMAN_USE_MODULES) endif() foreach(EXAMPLE ${EXAMPLES}) - set(EXAMPLE_TARGET ${TARGET_PREFIX}.examples.${EXAMPLE}) + set(EXAMPLE_TARGET ${PROJECT_NAME}.${EXAMPLE}) add_executable(${EXAMPLE_TARGET}) target_sources(${EXAMPLE_TARGET} PRIVATE ${EXAMPLE}.cpp) - target_link_libraries( - ${EXAMPLE_TARGET} - PRIVATE ${TARGET_NAMESPACE}::${TARGET_NAME} - ) + if(BEMAN_USE_MODULES) + target_link_libraries(${EXAMPLE_TARGET} PRIVATE beman::execution) + else() + target_link_libraries( + ${EXAMPLE_TARGET} + PRIVATE beman::execution_headers + ) + endif() + add_test(NAME ${EXAMPLE_TARGET} COMMAND ${EXAMPLE_TARGET}) endforeach() diff --git a/examples/allocator.cpp b/examples/allocator.cpp index 6fbbe49b..845275ff 100644 --- a/examples/allocator.cpp +++ b/examples/allocator.cpp @@ -75,5 +75,5 @@ auto main() -> int { })}; inline_resource<1024> state_resource("state"); - ex::sync_wait(ex::detail::write_env(std::move(s), allocator_env{&state_resource})); + ex::sync_wait(ex::write_env(std::move(s), allocator_env{&state_resource})); } diff --git a/examples/intro-5-consumer.cpp b/examples/intro-5-consumer.cpp index 1e769423..2b2df822 100644 --- a/examples/intro-5-consumer.cpp +++ b/examples/intro-5-consumer.cpp @@ -1,17 +1,57 @@ -// examples/intro-1-hello-world.cpp -*-C++-*- +// examples/intro-5-consumer.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include #include -#include +#include +//-dk:TODO restore if that actually works #include #include #include #include +#include #include namespace ex = ::beman::execution; using namespace std::string_literals; +namespace tst { +template +struct expected { + std::variant value_or_error{}; + expected(T&& value) noexcept : value_or_error(std::in_place_index<1>, std::forward(value)) {} + expected(E&& error) noexcept : value_or_error(std::in_place_index<2>, std::forward(error)) {} + explicit operator bool() const noexcept { return this->value_or_error.index() == 1; } + auto value_or(T&& default_value) && noexcept -> T { + if (this->value_or_error.index() == 1) { + return std::move(std::get<1>(this->value_or_error)); + } else { + return std::forward(default_value); + } + } + auto value_or(T&& default_value) & noexcept -> T { + if (this->value_or_error.index() == 1) { + return std::get<1>(this->value_or_error); + } else { + return std::forward(default_value); + } + } + auto error_or(E&& default_error) && noexcept -> E { + if (this->value_or_error.index() == 2) { + return std::move(std::get<2>(this->value_or_error)); + } else { + return std::forward(default_error); + } + } + auto error_or(E&& default_error) & noexcept -> E { + if (this->value_or_error.index() == 2) { + return std::get<2>(this->value_or_error); + } else { + return std::forward(default_error); + } + } +}; +} // namespace tst + enum class success : std::uint8_t { one }; enum class failure : std::uint8_t { fail_one }; @@ -21,7 +61,7 @@ struct expected_to_channel_t { using receiver_concept = ex::receiver_t; Receiver* receiver; template - auto set_value(std::expected&& exp) noexcept -> void { + auto set_value(tst::expected&& exp) noexcept -> void { if (exp) { std::cout << "received an expected with value from child/upstream\n" << std::flush; ex::set_value(std::move(*receiver), exp.value_or(Value{})); @@ -88,7 +128,7 @@ struct expected_to_channel_t { inline constexpr expected_to_channel_t expected_to_channel{}; int main() { - ex::sync_wait(ex::just(std::expected(success::one)) | expected_to_channel() | + ex::sync_wait(ex::just(tst::expected(success::one)) | expected_to_channel() | ex::then([](success) noexcept { std::cout << "success\n"; }) | ex::upon_error([](failure) noexcept { std::cout << "fail\n"; })); } diff --git a/examples/modules.cpp b/examples/modules.cpp index b3c245c9..a86f861c 100644 --- a/examples/modules.cpp +++ b/examples/modules.cpp @@ -8,13 +8,16 @@ import std; #include #include #include +#include +#include +#include #endif -#if __cpp_modules < 201907L -#include +#ifdef BEMAN_USE_MODULES +import beman.execution; #else -import beman_execution; +#include #endif namespace ex = beman::execution; diff --git a/examples/stackoverflow.cpp b/examples/stackoverflow.cpp index 6902f2d6..b243fdee 100644 --- a/examples/stackoverflow.cpp +++ b/examples/stackoverflow.cpp @@ -19,7 +19,7 @@ struct task { struct final_awaiter { base* data; bool await_ready() noexcept { return false; } - auto await_suspend(auto h) noexcept { this->data->complete_value(); }; + auto await_suspend(auto) noexcept { this->data->complete_value(); }; void await_resume() noexcept {} }; std::suspend_always initial_suspend() const noexcept { return {}; } @@ -71,6 +71,7 @@ struct task { int main(int ac, char*[]) { std::cout << std::unitbuf; +#ifndef _MSC_VER using on_exit = std::unique_ptr; static_assert(ex::sender); ex::sync_wait([](int n) -> task { @@ -89,4 +90,5 @@ int main(int ac, char*[]) { } co_await ex::just_stopped(); }(ac < 2 ? 3 : 30000)); +#endif } diff --git a/examples/stopping.cpp b/examples/stopping.cpp index fdbbbaa6..86a92fa4 100644 --- a/examples/stopping.cpp +++ b/examples/stopping.cpp @@ -84,12 +84,13 @@ int main() { inject_cancel_sender{token, ex::read_env(ex::get_stop_token) | ex::then([](ex::inplace_stop_token tok) { while (not tok.stop_requested()) { std::cout << "sleeping\n"; - std::this_thread::sleep_for(1s); + std::this_thread::sleep_for(10ms); } })}); }); - std::cin.get(); + // std::cin.get(); + std::this_thread::sleep_for(100ms); std::cout << "requesting stop\n"; source.request_stop(); diff --git a/include/beman/execution/detail/affine_on.hpp b/include/beman/execution/detail/affine_on.hpp index 35a6288e..45a3ea15 100644 --- a/include/beman/execution/detail/affine_on.hpp +++ b/include/beman/execution/detail/affine_on.hpp @@ -1,9 +1,10 @@ // include/beman/execution/detail/affine_on.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_AFFINE_ON -#define INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_AFFINE_ON +#ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_AFFINE_ON +#define INCLUDED_BEMAN_EXECUTION_DETAIL_AFFINE_ON +#include #include #include #include @@ -115,16 +116,7 @@ struct affine_on_t : ::beman::execution::sender_adaptor_closure { [[maybe_unused]] auto& [tag, data, child] = sender; using child_tag_t = ::beman::execution::tag_of_t<::std::remove_cvref_t>; -#if 0 - if constexpr (requires(const child_tag_t& t) { - { - t.affine_on(::beman::execution::detail::forward_like(child), ev) - } -> ::beman::execution::sender; - }) -#else - if constexpr (::beman::execution::detail::nested_sender_has_affine_on) -#endif - { + if constexpr (::beman::execution::detail::nested_sender_has_affine_on) { constexpr child_tag_t t{}; return t.affine_on(::beman::execution::detail::forward_like(child), ev); } else { @@ -144,12 +136,12 @@ namespace beman::execution { * @brief affine_on is a CPO, used to adapt a sender to complete on the scheduler * it got started on which is derived from get_scheduler on the receiver's environment. */ -using beman::execution::detail::affine_on_t; -inline constexpr affine_on_t affine_on{}; +BEMAN_EXECUTION_EXPORT using affine_on_t = beman::execution::detail::affine_on_t; +BEMAN_EXECUTION_EXPORT inline constexpr affine_on_t affine_on{}; } // namespace beman::execution // ---------------------------------------------------------------------------- #include -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_AFFINE_ON diff --git a/include/beman/execution/detail/allocator_aware_move.hpp b/include/beman/execution/detail/allocator_aware_move.hpp index baf1ffa0..4b4db2ad 100644 --- a/include/beman/execution/detail/allocator_aware_move.hpp +++ b/include/beman/execution/detail/allocator_aware_move.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_ALLOCATOR_AWARE_MOVE #define INCLUDED_BEMAN_EXECUTION_DETAIL_ALLOCATOR_AWARE_MOVE +#include #include #include #include @@ -41,4 +42,4 @@ auto allocator_aware_move(T&& obj, Context&& context) noexcept -> decltype(auto) // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_ALLOCATOR_AWARE_MOVE diff --git a/include/beman/execution/detail/almost_scheduler.hpp b/include/beman/execution/detail/almost_scheduler.hpp index ff597ec6..bc418175 100644 --- a/include/beman/execution/detail/almost_scheduler.hpp +++ b/include/beman/execution/detail/almost_scheduler.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_ALMOST_SCHEDULER #define INCLUDED_BEMAN_EXECUTION_DETAIL_ALMOST_SCHEDULER +#include #include #include #include @@ -34,4 +35,4 @@ concept almost_scheduler = ::std::derived_from #include #include #include @@ -15,7 +16,7 @@ namespace beman::execution { * \brief Function used to transform a sender and its arguments for a domain. * \headerfile beman/execution/execution.hpp */ -template +BEMAN_EXECUTION_EXPORT template requires requires(Domain domain, Tag tag, Sender&& sender, Args&&... args) { domain.apply_sender(Tag(), ::std::forward(sender), ::std::forward(args)...); } @@ -47,4 +48,4 @@ constexpr auto apply_sender(Domain, Tag, Sender&& sender, Args&&... args) noexce // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_APPLY_SENDER diff --git a/include/beman/execution/detail/as_awaitable.hpp b/include/beman/execution/detail/as_awaitable.hpp index 9ffd2439..c299be5b 100644 --- a/include/beman/execution/detail/as_awaitable.hpp +++ b/include/beman/execution/detail/as_awaitable.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_AS_AWAITABLE #define INCLUDED_BEMAN_EXECUTION_DETAIL_AS_AWAITABLE +#include #include #include #include @@ -20,7 +21,7 @@ namespace beman::execution { * \brief Turn an entity, e.g., a sender, into an awaitable. * \headerfile beman/execution/execution.hpp */ -struct as_awaitable_t { +BEMAN_EXECUTION_EXPORT struct as_awaitable_t { template auto operator()(Expr&& expr, Promise& promise) const { if constexpr (requires { ::std::forward(expr).as_awaitable(promise); }) { @@ -38,9 +39,9 @@ struct as_awaitable_t { } } }; -inline constexpr ::beman::execution::as_awaitable_t as_awaitable{}; +BEMAN_EXECUTION_EXPORT inline constexpr ::beman::execution::as_awaitable_t as_awaitable{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_AS_AWAITABLE diff --git a/include/beman/execution/detail/as_except_ptr.hpp b/include/beman/execution/detail/as_except_ptr.hpp index 7d5d1b23..c14d5633 100644 --- a/include/beman/execution/detail/as_except_ptr.hpp +++ b/include/beman/execution/detail/as_except_ptr.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_AS_EXCEPT_PTR #define INCLUDED_BEMAN_EXECUTION_DETAIL_AS_EXCEPT_PTR +#include #include #include #include @@ -33,4 +34,4 @@ decltype(auto) as_except_ptr(Error&& error) { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_AS_EXCEPT_PTR diff --git a/include/beman/execution/detail/as_tuple.hpp b/include/beman/execution/detail/as_tuple.hpp index 1b7baa21..b00c530c 100644 --- a/include/beman/execution/detail/as_tuple.hpp +++ b/include/beman/execution/detail/as_tuple.hpp @@ -1,9 +1,10 @@ // include/beman/execution/detail/as_tuple.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_AS_TUPLE -#define INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_AS_TUPLE +#ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_AS_TUPLE +#define INCLUDED_BEMAN_EXECUTION_DETAIL_AS_TUPLE +#include #include // ---------------------------------------------------------------------------- @@ -30,4 +31,4 @@ using as_tuple_t = typename ::beman::execution::detail::as_tuple::type; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_AS_TUPLE diff --git a/include/beman/execution/detail/associate.hpp b/include/beman/execution/detail/associate.hpp index d8b76717..d7413610 100644 --- a/include/beman/execution/detail/associate.hpp +++ b/include/beman/execution/detail/associate.hpp @@ -1,13 +1,15 @@ // include/beman/execution/detail/associate.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_ASSOCIATE -#define INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_ASSOCIATE +#ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_ASSOCIATE +#define INCLUDED_BEMAN_EXECUTION_DETAIL_ASSOCIATE +#include #include #include #include #include +#include #include #include #include @@ -15,7 +17,6 @@ #include #include #include -#include //-dk:TODO remove // ---------------------------------------------------------------------------- @@ -154,10 +155,10 @@ struct completion_signatures_for_impl< } // namespace beman::execution::detail namespace beman::execution { -using associate_t = ::beman::execution::detail::associate_t; -inline constexpr associate_t associate{}; +BEMAN_EXECUTION_EXPORT using associate_t = ::beman::execution::detail::associate_t; +BEMAN_EXECUTION_EXPORT inline constexpr associate_t associate{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_ASSOCIATE diff --git a/include/beman/execution/detail/atomic_intrusive_stack.hpp b/include/beman/execution/detail/atomic_intrusive_stack.hpp index 522d1533..38cf748e 100644 --- a/include/beman/execution/detail/atomic_intrusive_stack.hpp +++ b/include/beman/execution/detail/atomic_intrusive_stack.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_ATOMIC_INTRUSIVE_STACK #define INCLUDED_BEMAN_EXECUTION_DETAIL_ATOMIC_INTRUSIVE_STACK +#include #include #include @@ -85,4 +86,4 @@ class atomic_intrusive_stack { } // namespace beman::execution::detail -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_ATOMIC_INTRUSIVE_STACK diff --git a/include/beman/execution/detail/await_result_type.hpp b/include/beman/execution/detail/await_result_type.hpp index 314a8c2a..51f82439 100644 --- a/include/beman/execution/detail/await_result_type.hpp +++ b/include/beman/execution/detail/await_result_type.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_AWAIT_RESULT_TYPE #define INCLUDED_BEMAN_EXECUTION_DETAIL_AWAIT_RESULT_TYPE +#include #include #include @@ -22,4 +23,4 @@ using await_result_type = // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_AWAIT_RESULT_TYPE diff --git a/include/beman/execution/detail/await_suspend_result.hpp b/include/beman/execution/detail/await_suspend_result.hpp index 3cbda126..2c21427b 100644 --- a/include/beman/execution/detail/await_suspend_result.hpp +++ b/include/beman/execution/detail/await_suspend_result.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_AWAIT_SUSPEND_RESULT #define INCLUDED_BEMAN_EXECUTION_DETAIL_AWAIT_SUSPEND_RESULT +#include #include #include #include @@ -38,4 +39,4 @@ concept await_suspend_result = // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_AWAIT_SUSPEND_RESULT diff --git a/include/beman/execution/detail/awaitable_sender.hpp b/include/beman/execution/detail/awaitable_sender.hpp index abfc6e63..069dd06e 100644 --- a/include/beman/execution/detail/awaitable_sender.hpp +++ b/include/beman/execution/detail/awaitable_sender.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_AWAITABLE_SENDER #define INCLUDED_BEMAN_EXECUTION_DETAIL_AWAITABLE_SENDER +#include #include #include @@ -18,4 +19,4 @@ concept awaitable_sender = }; } // namespace beman::execution::detail -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_AWAITABLE_SENDER diff --git a/include/beman/execution/detail/basic_operation.hpp b/include/beman/execution/detail/basic_operation.hpp index 8873c28c..be78f56b 100644 --- a/include/beman/execution/detail/basic_operation.hpp +++ b/include/beman/execution/detail/basic_operation.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_BASIC_OPERATION #define INCLUDED_BEMAN_EXECUTION_DETAIL_BASIC_OPERATION +#include #include #include #include @@ -66,4 +67,4 @@ basic_operation(Sender&&, Receiver&&) -> basic_operation; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_BASIC_OPERATION diff --git a/include/beman/execution/detail/basic_receiver.hpp b/include/beman/execution/detail/basic_receiver.hpp index 8cf22e5e..1a3cd47b 100644 --- a/include/beman/execution/detail/basic_receiver.hpp +++ b/include/beman/execution/detail/basic_receiver.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_BASIC_RECEIVER #define INCLUDED_BEMAN_EXECUTION_DETAIL_BASIC_RECEIVER +#include #include #include #include @@ -29,7 +30,7 @@ namespace beman::execution::detail { */ template requires ::beman::execution::detail:: - valid_specialization< ::beman::execution::detail::env_type, Index, Sender, Receiver> + valid_specialization<::beman::execution::detail::env_type, Index, Sender, Receiver> struct basic_receiver { friend struct ::beman::execution::get_env_t; friend struct ::beman::execution::set_error_t; @@ -82,4 +83,4 @@ template // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_BASIC_RECEIVER diff --git a/include/beman/execution/detail/basic_sender.hpp b/include/beman/execution/detail/basic_sender.hpp index 7884cbb2..a7e1bc92 100644 --- a/include/beman/execution/detail/basic_sender.hpp +++ b/include/beman/execution/detail/basic_sender.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_BASIC_SENDER #define INCLUDED_BEMAN_EXECUTION_DETAIL_BASIC_SENDER +#include #include #include #include @@ -27,7 +28,7 @@ namespace beman::execution::detail { */ template struct basic_sender : ::beman::execution::detail::product_type { - friend struct ::beman::execution::connect_t; + friend struct ::beman::execution::detail::connect_t; friend struct ::beman::execution::get_completion_signatures_t; using sender_concept = ::beman::execution::sender_t; using indices_for = ::std::index_sequence_for; @@ -108,4 +109,4 @@ struct basic_sender : ::beman::execution::detail::product_type -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_BASIC_SENDER diff --git a/include/beman/execution/detail/basic_state.hpp b/include/beman/execution/detail/basic_state.hpp index 5b43d9ec..62d7b781 100644 --- a/include/beman/execution/detail/basic_state.hpp +++ b/include/beman/execution/detail/basic_state.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_BASIC_STATE #define INCLUDED_BEMAN_EXECUTION_DETAIL_BASIC_STATE +#include #include #include #include @@ -23,7 +24,7 @@ template struct basic_state { basic_state(Sender&& sender, Receiver&& rcvr) noexcept(true) : receiver(::std::move(rcvr)), - state(::beman::execution::detail::impls_for< ::beman::execution::tag_of_t >::get_state( + state(::beman::execution::detail::impls_for<::beman::execution::tag_of_t>::get_state( ::std::forward(sender), this->receiver)) {} Receiver receiver; @@ -35,4 +36,4 @@ basic_state(Sender&&, Receiver&&) -> basic_state; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_BASIC_STATE diff --git a/include/beman/execution/detail/bulk.hpp b/include/beman/execution/detail/bulk.hpp index d1453ccf..5508b18c 100644 --- a/include/beman/execution/detail/bulk.hpp +++ b/include/beman/execution/detail/bulk.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_BULK #define INCLUDED_BEMAN_EXECUTION_DETAIL_BULK +#include #include "beman/execution/detail/sender_adaptor.hpp" #include "beman/execution/detail/sender_adaptor_closure.hpp" #include @@ -133,9 +134,9 @@ struct completion_signatures_for_impl< namespace beman::execution { -using ::beman::execution::detail::bulk_t; -inline constexpr ::beman::execution::bulk_t bulk{}; +BEMAN_EXECUTION_EXPORT using bulk_t = ::beman::execution::detail::bulk_t; +BEMAN_EXECUTION_EXPORT inline constexpr ::beman::execution::bulk_t bulk{}; } // namespace beman::execution -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_BULK diff --git a/include/beman/execution/detail/call_result_t.hpp b/include/beman/execution/detail/call_result_t.hpp index a29e8fe2..ab681798 100644 --- a/include/beman/execution/detail/call_result_t.hpp +++ b/include/beman/execution/detail/call_result_t.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_CALL_RESULT #define INCLUDED_BEMAN_EXECUTION_DETAIL_CALL_RESULT +#include #include // ---------------------------------------------------------------------------- @@ -20,4 +21,4 @@ using call_result_t = decltype(::std::declval()(std::declval()...)); // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_CALL_RESULT diff --git a/include/beman/execution/detail/callable.hpp b/include/beman/execution/detail/callable.hpp index c1c61c22..f6a9122f 100644 --- a/include/beman/execution/detail/callable.hpp +++ b/include/beman/execution/detail/callable.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_CALLABLE #define INCLUDED_BEMAN_EXECUTION_DETAIL_CALLABLE +#include #include // ---------------------------------------------------------------------------- @@ -21,4 +22,4 @@ concept callable = requires(Fun&& fun, Args&&... args) { ::std::forward(fun // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_CALLABLE diff --git a/include/beman/execution/detail/check_type_alias_exist.hpp b/include/beman/execution/detail/check_type_alias_exist.hpp index c305690a..e609a8e8 100644 --- a/include/beman/execution/detail/check_type_alias_exist.hpp +++ b/include/beman/execution/detail/check_type_alias_exist.hpp @@ -4,6 +4,8 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_CHECK_TYPE_ALIAS_EXIST #define INCLUDED_BEMAN_EXECUTION_DETAIL_CHECK_TYPE_ALIAS_EXIST +#include + // ---------------------------------------------------------------------------- namespace beman::execution::detail { @@ -18,4 +20,4 @@ struct check_type_alias_exist; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_CHECK_TYPE_ALIAS_EXIST diff --git a/include/beman/execution/detail/child_type.hpp b/include/beman/execution/detail/child_type.hpp index e3cab29b..63fd1c71 100644 --- a/include/beman/execution/detail/child_type.hpp +++ b/include/beman/execution/detail/child_type.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_CHILD_TYPE #define INCLUDED_BEMAN_EXECUTION_DETAIL_CHILD_TYPE +#include #include #include @@ -21,4 +22,4 @@ using child_type = decltype(::std::declval().template get()); // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_CHILD_TYPE diff --git a/include/beman/execution/detail/class_type.hpp b/include/beman/execution/detail/class_type.hpp index 88dbc582..c92cf5d2 100644 --- a/include/beman/execution/detail/class_type.hpp +++ b/include/beman/execution/detail/class_type.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_CLASS_TYPE #define INCLUDED_BEMAN_EXECUTION_DETAIL_CLASS_TYPE +#include #include #include @@ -21,4 +22,4 @@ concept class_type = ::beman::execution::detail::decays_to && ::std::is_ // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_CLASS_TYPE diff --git a/include/beman/execution/detail/common.hpp b/include/beman/execution/detail/common.hpp index 95528a5d..975537a8 100644 --- a/include/beman/execution/detail/common.hpp +++ b/include/beman/execution/detail/common.hpp @@ -6,6 +6,10 @@ // ---------------------------------------------------------------------------- +#ifndef BEMAN_EXECUTION_EXPORT +#define BEMAN_EXECUTION_EXPORT +#endif + #if defined(disabled__cpp_deleted_function) #define BEMAN_EXECUTION_DELETE(msg) delete (msg) #else @@ -60,4 +64,4 @@ namespace detail {} // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_COMMON diff --git a/include/beman/execution/detail/completion_domain.hpp b/include/beman/execution/detail/completion_domain.hpp index f9d1e72e..ebc87003 100644 --- a/include/beman/execution/detail/completion_domain.hpp +++ b/include/beman/execution/detail/completion_domain.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_DOMAIN #define INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_DOMAIN +#include #include #include #include @@ -59,10 +60,10 @@ constexpr auto completion_domain(const Sender& sender) noexcept { typename completion_domain_merge::type, decltype(get(::beman::execution::set_value, sender))>::type; - return ::std::conditional_t< ::std::same_as, Default, type>(); + return ::std::conditional_t<::std::same_as, Default, type>(); } } // namespace beman::execution::detail // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_DOMAIN diff --git a/include/beman/execution/detail/completion_signature.hpp b/include/beman/execution/detail/completion_signature.hpp index 49ff4165..11b06b7b 100644 --- a/include/beman/execution/detail/completion_signature.hpp +++ b/include/beman/execution/detail/completion_signature.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_SIGNATURE #define INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_SIGNATURE +#include #include #include #include @@ -46,4 +47,4 @@ concept completion_signature = // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_SIGNATURE diff --git a/include/beman/execution/detail/completion_signatures.hpp b/include/beman/execution/detail/completion_signatures.hpp index f520a0c9..a7a8d449 100644 --- a/include/beman/execution/detail/completion_signatures.hpp +++ b/include/beman/execution/detail/completion_signatures.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_SIGNATURES #define INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_SIGNATURES +#include #include #include #include @@ -20,10 +21,10 @@ namespace beman::execution { * any specializaion are empty. Objects may be created to return them from * functions used for type computations like get_completion_signatures(sender, env). */ -template <::beman::execution::detail::completion_signature...> +BEMAN_EXECUTION_EXPORT template <::beman::execution::detail::completion_signature...> struct completion_signatures {}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_SIGNATURES diff --git a/include/beman/execution/detail/completion_signatures_for.hpp b/include/beman/execution/detail/completion_signatures_for.hpp index 6c4d5744..b0b09530 100644 --- a/include/beman/execution/detail/completion_signatures_for.hpp +++ b/include/beman/execution/detail/completion_signatures_for.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_SIGNATURES_FOR #define INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_SIGNATURES_FOR +#include #include #include #include @@ -39,10 +40,10 @@ template using completion_signatures_for = ::std::conditional_t< ::std::same_as::type>, - typename ::beman::execution::detail::completion_signatures_for_impl< ::std::remove_cvref_t, Env>::type, + typename ::beman::execution::detail::completion_signatures_for_impl<::std::remove_cvref_t, Env>::type, typename ::beman::execution::detail::completion_signatures_for_impl::type>; } // namespace beman::execution::detail // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_SIGNATURES_FOR diff --git a/include/beman/execution/detail/completion_signatures_of_t.hpp b/include/beman/execution/detail/completion_signatures_of_t.hpp index c1889484..3b6d6748 100644 --- a/include/beman/execution/detail/completion_signatures_of_t.hpp +++ b/include/beman/execution/detail/completion_signatures_of_t.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_SIGNATURES_OF #define INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_SIGNATURES_OF +#include #include #include #include @@ -16,7 +17,7 @@ namespace beman::execution { * \brief Alias to access the completion signatures of a sender * \headerfile beman/execution/execution.hpp */ -template > +BEMAN_EXECUTION_EXPORT template > requires ::beman::execution::sender_in using completion_signatures_of_t = ::beman::execution::detail::call_result_t<::beman::execution::get_completion_signatures_t, Sender, Env>; @@ -24,4 +25,4 @@ using completion_signatures_of_t = // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_SIGNATURES_OF diff --git a/include/beman/execution/detail/completion_tag.hpp b/include/beman/execution/detail/completion_tag.hpp index 7f092e61..6376724b 100644 --- a/include/beman/execution/detail/completion_tag.hpp +++ b/include/beman/execution/detail/completion_tag.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_TAG #define INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_TAG +#include #include #include #include @@ -25,4 +26,4 @@ concept completion_tag = // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_COMPLETION_TAG diff --git a/include/beman/execution/detail/connect.hpp b/include/beman/execution/detail/connect.hpp index 50fcb2af..f4e30b07 100644 --- a/include/beman/execution/detail/connect.hpp +++ b/include/beman/execution/detail/connect.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_CONNECT #define INCLUDED_BEMAN_EXECUTION_DETAIL_CONNECT +#include #include #include #include @@ -20,7 +21,8 @@ namespace beman::execution::detail { * \headerfile beman/execution/execution.hpp * \internal */ -struct connect_t { +//-dk:TODO this seems to needed for MSVC++ (2026-01-30) +BEMAN_EXECUTION_EXPORT struct connect_t { private: template static auto make_new_sender(Sender&& sender, Receiver&& receiver) @@ -81,7 +83,7 @@ namespace beman::execution { * \brief Type of the connect customization point object. * \headerfile beman/execution/execution.hpp */ -using beman::execution::detail::connect_t; +BEMAN_EXECUTION_EXPORT using connect_t = beman::execution::detail::connect_t; /*! * \brief Customization point object used to connect a sender and a receiver. * \headerfile beman/execution/execution.hpp @@ -90,9 +92,9 @@ using beman::execution::detail::connect_t; * `connect(sender, receiver)` returns the result of calling `sender.connect(receiver)`. * The returned object `state` is an `operation_state` object. */ -inline constexpr connect_t connect{}; +BEMAN_EXECUTION_EXPORT inline constexpr connect_t connect{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_CONNECT diff --git a/include/beman/execution/detail/connect_all.hpp b/include/beman/execution/detail/connect_all.hpp index 8efc91bf..afc36186 100644 --- a/include/beman/execution/detail/connect_all.hpp +++ b/include/beman/execution/detail/connect_all.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_CONNECT_ALL #define INCLUDED_BEMAN_EXECUTION_DETAIL_CONNECT_ALL +#include #include #include #include @@ -78,13 +79,13 @@ struct connect_all_t { auto operator()(::std::index_sequence, C&&... c) noexcept( (noexcept(::beman::execution::connect( ::beman::execution::detail::forward_like(c), - ::beman::execution::detail::basic_receiver>{ - this->op})) && + ::beman::execution::detail:: + basic_receiver>{this->op})) && ... && true)) -> decltype(auto) { return ::beman::execution::detail::product_type{::beman::execution::connect( ::beman::execution::detail::forward_like(c), - ::beman::execution::detail::basic_receiver>{ - this->op})...}; + ::beman::execution::detail:: + basic_receiver>{this->op})...}; } }; @@ -128,4 +129,4 @@ inline constexpr connect_all_t connect_all{}; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_CONNECT_ALL diff --git a/include/beman/execution/detail/connect_all_result.hpp b/include/beman/execution/detail/connect_all_result.hpp index 3a479dac..0bea8680 100644 --- a/include/beman/execution/detail/connect_all_result.hpp +++ b/include/beman/execution/detail/connect_all_result.hpp @@ -1,9 +1,10 @@ // include/beman/execution/detail/connect_all_result.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_CONNECT_ALL_RESULT -#define INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_CONNECT_ALL_RESULT +#ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_CONNECT_ALL_RESULT +#define INCLUDED_BEMAN_EXECUTION_DETAIL_CONNECT_ALL_RESULT +#include #include #include #include @@ -22,9 +23,9 @@ using connect_all_result = ::beman::execution::detail::call_result_t*, Sender, - ::beman::execution::detail::indices_for >; + ::beman::execution::detail::indices_for>; } // namespace beman::execution::detail // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_CONNECT_ALL_RESULT diff --git a/include/beman/execution/detail/connect_awaitable.hpp b/include/beman/execution/detail/connect_awaitable.hpp index 46556496..d708340d 100644 --- a/include/beman/execution/detail/connect_awaitable.hpp +++ b/include/beman/execution/detail/connect_awaitable.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_CONNECT_AWAITABLE #define INCLUDED_BEMAN_EXECUTION_DETAIL_CONNECT_AWAITABLE +#include #include #include #include @@ -47,9 +48,9 @@ struct awaiter_set_value { */ template using awaiter_completion_signatures = ::beman::execution::completion_signatures< - typename ::beman::execution::detail::awaiter_set_value< ::beman::execution::detail::await_result_type< + typename ::beman::execution::detail::awaiter_set_value<::beman::execution::detail::await_result_type< Awaiter, - ::beman::execution::detail::connect_awaitable_promise > >::type, + ::beman::execution::detail::connect_awaitable_promise>>::type, ::beman::execution::set_error_t(::std::exception_ptr), ::beman::execution::set_stopped_t()>; @@ -62,12 +63,13 @@ template auto connect_awaitable(Awaiter awaiter, Receiver receiver) -> ::beman::execution::detail::operation_state_task requires ::beman::execution:: - receiver_of > + receiver_of> { // NOTE: suspened_complete(...) is co_await to make sure that the // coroutine is suspended at the point when set_*(...) is called. - using result_type = ::beman::execution::detail:: - await_result_type >; + using result_type = + ::beman::execution::detail::await_result_type>; ::std::exception_ptr ep; try { @@ -88,4 +90,4 @@ auto connect_awaitable(Awaiter awaiter, Receiver receiver) // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_CONNECT_AWAITABLE diff --git a/include/beman/execution/detail/connect_result_t.hpp b/include/beman/execution/detail/connect_result_t.hpp index 829656fb..0d821b68 100644 --- a/include/beman/execution/detail/connect_result_t.hpp +++ b/include/beman/execution/detail/connect_result_t.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_CONNECT_RESULT #define INCLUDED_BEMAN_EXECUTION_DETAIL_CONNECT_RESULT +#include #include #include @@ -14,10 +15,10 @@ namespace beman::execution { * \brief Type alias to determine the operation state type returned from `connect()`. * \headerfile beman/execution/execution.hpp */ -template +BEMAN_EXECUTION_EXPORT template using connect_result_t = decltype(::beman::execution::connect(::std::declval(), ::std::declval())); } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_CONNECT_RESULT diff --git a/include/beman/execution/detail/continues_on.hpp b/include/beman/execution/detail/continues_on.hpp index 75a5786f..1a53e8cc 100644 --- a/include/beman/execution/detail/continues_on.hpp +++ b/include/beman/execution/detail/continues_on.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_CONTINUES_ON #define INCLUDED_BEMAN_EXECUTION_DETAIL_CONTINUES_ON +#include #include #include #include @@ -86,14 +87,14 @@ auto get_domain_late(Sender&& sender, Env&&) { #include namespace beman::execution { -using ::beman::execution::detail::continues_on_t; +BEMAN_EXECUTION_EXPORT using continues_on_t = ::beman::execution::detail::continues_on_t; /*! * \brief Customization point object to create a `continues_on` sender. * \headerfile beman/execution/execution.hpp */ -inline constexpr continues_on_t continues_on{}; +BEMAN_EXECUTION_EXPORT inline constexpr continues_on_t continues_on{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_CONTINUES_ON diff --git a/include/beman/execution/detail/counting_scope.hpp b/include/beman/execution/detail/counting_scope.hpp index 30def4a7..fb1c51d5 100644 --- a/include/beman/execution/detail/counting_scope.hpp +++ b/include/beman/execution/detail/counting_scope.hpp @@ -1,9 +1,10 @@ // include/beman/execution/detail/counting_scope.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_COUNTING_SCOPE -#define INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_COUNTING_SCOPE +#ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_COUNTING_SCOPE +#define INCLUDED_BEMAN_EXECUTION_DETAIL_COUNTING_SCOPE +#include #include #include #include @@ -16,7 +17,7 @@ // ---------------------------------------------------------------------------- namespace beman::execution { -class counting_scope; +BEMAN_EXECUTION_EXPORT class counting_scope; } // ---------------------------------------------------------------------------- @@ -59,4 +60,4 @@ inline auto beman::execution::counting_scope::get_token() noexcept -> beman::exe return beman::execution::counting_scope::token(this); } -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_COUNTING_SCOPE diff --git a/include/beman/execution/detail/counting_scope_base.hpp b/include/beman/execution/detail/counting_scope_base.hpp index b902f0b8..4f5b722f 100644 --- a/include/beman/execution/detail/counting_scope_base.hpp +++ b/include/beman/execution/detail/counting_scope_base.hpp @@ -1,9 +1,10 @@ // include/beman/execution/detail/counting_scope_base.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_COUNTING_SCOPE_BASE -#define INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_COUNTING_SCOPE_BASE +#ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_COUNTING_SCOPE_BASE +#define INCLUDED_BEMAN_EXECUTION_DETAIL_COUNTING_SCOPE_BASE +#include #include #include #include @@ -164,4 +165,4 @@ inline auto beman::execution::detail::counting_scope_base::start_node(node* n) - // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_COUNTING_SCOPE_BASE diff --git a/include/beman/execution/detail/counting_scope_join.hpp b/include/beman/execution/detail/counting_scope_join.hpp index 0673242c..2d557692 100644 --- a/include/beman/execution/detail/counting_scope_join.hpp +++ b/include/beman/execution/detail/counting_scope_join.hpp @@ -1,9 +1,10 @@ // include/beman/execution/detail/counting_scope_join.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_COUNTING_SCOPE_JOIN -#define INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_COUNTING_SCOPE_JOIN +#ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_COUNTING_SCOPE_JOIN +#define INCLUDED_BEMAN_EXECUTION_DETAIL_COUNTING_SCOPE_JOIN +#include #include #include #include @@ -84,4 +85,4 @@ struct impls_for<::beman::execution::detail::counting_scope_join_t> : ::beman::e // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_COUNTING_SCOPE_JOIN diff --git a/include/beman/execution/detail/decayed_same_as.hpp b/include/beman/execution/detail/decayed_same_as.hpp index 6a24fca0..1ddd6336 100644 --- a/include/beman/execution/detail/decayed_same_as.hpp +++ b/include/beman/execution/detail/decayed_same_as.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_DECAYED_SAME_AS #define INCLUDED_BEMAN_EXECUTION_DETAIL_DECAYED_SAME_AS +#include #include // ---------------------------------------------------------------------------- @@ -21,4 +22,4 @@ concept decayed_same_as = ::std::same_as<::std::remove_cvref_t, ::std::remov // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_DECAYED_SAME_AS diff --git a/include/beman/execution/detail/decayed_tuple.hpp b/include/beman/execution/detail/decayed_tuple.hpp index 41e574e7..c46402cf 100644 --- a/include/beman/execution/detail/decayed_tuple.hpp +++ b/include/beman/execution/detail/decayed_tuple.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_DECAYED_TUPLE #define INCLUDED_BEMAN_EXECUTION_DETAIL_DECAYED_TUPLE +#include #include #include @@ -21,4 +22,4 @@ using decayed_tuple = ::std::tuple<::std::decay_t...>; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_DECAYED_TUPLE diff --git a/include/beman/execution/detail/decayed_type_list.hpp b/include/beman/execution/detail/decayed_type_list.hpp index d6165085..9e6deb2a 100644 --- a/include/beman/execution/detail/decayed_type_list.hpp +++ b/include/beman/execution/detail/decayed_type_list.hpp @@ -4,8 +4,8 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_DECAYED_TYPE_LIST #define INCLUDED_BEMAN_EXECUTION_DETAIL_DECAYED_TYPE_LIST +#include #include "beman/execution/detail/type_list.hpp" - #include // ---------------------------------------------------------------------------- @@ -17,4 +17,4 @@ using decayed_type_list = ::beman::execution::detail::type_list<::std::decay_t #include // ---------------------------------------------------------------------------- @@ -20,4 +21,4 @@ using decayed_typeof = ::std::decay_t; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_DECAYED_TYPEOF diff --git a/include/beman/execution/detail/decays_to.hpp b/include/beman/execution/detail/decays_to.hpp index 3f88166b..5dae74b3 100644 --- a/include/beman/execution/detail/decays_to.hpp +++ b/include/beman/execution/detail/decays_to.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_DECAYS_TO #define INCLUDED_BEMAN_EXECUTION_DETAIL_DECAYS_TO +#include #include #include @@ -21,4 +22,4 @@ concept decays_to = ::std::same_as<::std::decay_t, To>; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_DECAYS_TO diff --git a/include/beman/execution/detail/default_domain.hpp b/include/beman/execution/detail/default_domain.hpp index ab271c13..bb29e791 100644 --- a/include/beman/execution/detail/default_domain.hpp +++ b/include/beman/execution/detail/default_domain.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_DEFAULT_DOMAIN #define INCLUDED_BEMAN_EXECUTION_DETAIL_DEFAULT_DOMAIN +#include #include #include #include @@ -24,7 +25,7 @@ namespace beman::execution { * tag type of the passed sender. If there is no corresponding member function * no transformation is applied. */ -struct default_domain { +BEMAN_EXECUTION_EXPORT struct default_domain { template <::beman::execution::sender Sender, ::beman::execution::detail::queryable... Env> requires(sizeof...(Env) <= 1) && requires(Sender&& sender, Env&&... env) { ::beman::execution::tag_of_t().transform_sender(::std::forward(sender), @@ -83,4 +84,4 @@ struct default_domain { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_DEFAULT_DOMAIN diff --git a/include/beman/execution/detail/default_impls.hpp b/include/beman/execution/detail/default_impls.hpp index 14e10c86..5576c902 100644 --- a/include/beman/execution/detail/default_impls.hpp +++ b/include/beman/execution/detail/default_impls.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_DEFAULT_IMPLS #define INCLUDED_BEMAN_EXECUTION_DETAIL_DEFAULT_IMPLS +#include #include #include #include @@ -26,13 +27,16 @@ namespace beman::execution::detail { * \internal */ struct default_impls { - static constexpr auto get_attrs = [](const auto&, const auto&... child) noexcept -> decltype(auto) { - if constexpr (1 == sizeof...(child)) - return (::beman::execution::detail::fwd_env(::beman::execution::get_env(child)), ...); - else - return ::beman::execution::env<>{}; + struct get_attrs_impl { + auto operator()(const auto&, const auto&... child) const noexcept -> decltype(auto) { + if constexpr (1 == sizeof...(child)) + return (::beman::execution::detail::fwd_env(::beman::execution::get_env(child)), ...); + else + return ::beman::execution::env<>{}; + } }; - static constexpr auto get_env = [](auto, auto&, const auto& receiver) noexcept -> decltype(auto) { + static constexpr auto get_attrs = get_attrs_impl{}; + static constexpr auto get_env = [](auto, auto&, const auto& receiver) noexcept -> decltype(auto) { return ::beman::execution::detail::fwd_env(::beman::execution::get_env(receiver)); }; static constexpr auto get_state = @@ -65,4 +69,4 @@ struct default_impls { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_DEFAULT_IMPLS diff --git a/include/beman/execution/detail/emplace_from.hpp b/include/beman/execution/detail/emplace_from.hpp index 781c3bbc..8c2fa834 100644 --- a/include/beman/execution/detail/emplace_from.hpp +++ b/include/beman/execution/detail/emplace_from.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_EMPLACE_FROM #define INCLUDED_BEMAN_EXECUTION_DETAIL_EMPLACE_FROM +#include #include #include #include @@ -32,4 +33,4 @@ emplace_from(Fun&&) -> emplace_from<::std::remove_cvref_t>; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_EMPLACE_FROM diff --git a/include/beman/execution/detail/env.hpp b/include/beman/execution/detail/env.hpp index b7b6610c..a5e9c072 100644 --- a/include/beman/execution/detail/env.hpp +++ b/include/beman/execution/detail/env.hpp @@ -1,9 +1,10 @@ // include/beman/execution/detail/env.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_ENV -#define INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_ENV +#ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_ENV +#define INCLUDED_BEMAN_EXECUTION_DETAIL_ENV +#include #include #include #include @@ -32,7 +33,7 @@ struct find_env { } // namespace beman::execution::detail namespace beman::execution { -template <::beman::execution::detail::queryable... Envs> +BEMAN_EXECUTION_EXPORT template <::beman::execution::detail::queryable... Envs> struct env; template <::beman::execution::detail::queryable... Envs> @@ -60,4 +61,4 @@ struct beman::execution::env : ::beman::execution::detail::env_base... { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_ENV diff --git a/include/beman/execution/detail/env_of_t.hpp b/include/beman/execution/detail/env_of_t.hpp index 08e7f365..0983b67d 100644 --- a/include/beman/execution/detail/env_of_t.hpp +++ b/include/beman/execution/detail/env_of_t.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_ENV_OF #define INCLUDED_BEMAN_EXECUTION_DETAIL_ENV_OF +#include #include #include @@ -14,10 +15,10 @@ namespace beman::execution { * \brief Determine the type of the environment associated with a type * \headerfile beman/execution/execution.hpp */ -template +BEMAN_EXECUTION_EXPORT template using env_of_t = decltype(::beman::execution::get_env(::std::declval())); } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_ENV_OF diff --git a/include/beman/execution/detail/env_promise.hpp b/include/beman/execution/detail/env_promise.hpp index 14fd5134..979546b6 100644 --- a/include/beman/execution/detail/env_promise.hpp +++ b/include/beman/execution/detail/env_promise.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_ENV_PROMISE #define INCLUDED_BEMAN_EXECUTION_DETAIL_ENV_PROMISE +#include #include #include @@ -29,4 +30,4 @@ struct env_promise : ::beman::execution::detail::with_await_transform { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_ENV_PROMISE diff --git a/include/beman/execution/detail/env_type.hpp b/include/beman/execution/detail/env_type.hpp index 19f517af..4869e4ef 100644 --- a/include/beman/execution/detail/env_type.hpp +++ b/include/beman/execution/detail/env_type.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_ENV_TYPE #define INCLUDED_BEMAN_EXECUTION_DETAIL_ENV_TYPE +#include #include #include #include @@ -20,7 +21,7 @@ namespace beman::execution::detail { */ template using env_type = ::beman::execution::detail::call_result_t< - decltype(::beman::execution::detail::impls_for< ::beman::execution::tag_of_t >::get_env), + decltype(::beman::execution::detail::impls_for<::beman::execution::tag_of_t>::get_env), Index, ::beman::execution::detail::state_type&, const Receiver&>; @@ -28,4 +29,4 @@ using env_type = ::beman::execution::detail::call_result_t< // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_ENV_TYPE diff --git a/include/beman/execution/detail/error_types_of_t.hpp b/include/beman/execution/detail/error_types_of_t.hpp index f1c1dcb3..4464805d 100644 --- a/include/beman/execution/detail/error_types_of_t.hpp +++ b/include/beman/execution/detail/error_types_of_t.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_ERROR_TYPES_OF #define INCLUDED_BEMAN_EXECUTION_DETAIL_ERROR_TYPES_OF +#include #include #include #include @@ -19,17 +20,17 @@ namespace beman::execution { * \brief Type alias to get error types for a sender * \headerfile beman/execution/execution.hpp */ -template , - template class Variant = ::beman::execution::detail::variant_or_empty> +BEMAN_EXECUTION_EXPORT template , + template class Variant = ::beman::execution::detail::variant_or_empty> requires ::beman::execution::sender_in using error_types_of_t = - ::beman::execution::detail::gather_signatures< ::beman::execution::set_error_t, - ::beman::execution::completion_signatures_of_t, - ::std::type_identity_t, - Variant>; + ::beman::execution::detail::gather_signatures<::beman::execution::set_error_t, + ::beman::execution::completion_signatures_of_t, + ::std::type_identity_t, + Variant>; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_ERROR_TYPES_OF diff --git a/include/beman/execution/detail/forward_like.hpp b/include/beman/execution/detail/forward_like.hpp index ead10794..7aa95fb3 100644 --- a/include/beman/execution/detail/forward_like.hpp +++ b/include/beman/execution/detail/forward_like.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_FORWARD_LIKE #define INCLUDED_BEMAN_EXECUTION_DETAIL_FORWARD_LIKE +#include #include #include @@ -76,4 +77,4 @@ auto forward_like(U&& u) noexcept -> decltype(auto) { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_FORWARD_LIKE diff --git a/include/beman/execution/detail/forwarding_query.hpp b/include/beman/execution/detail/forwarding_query.hpp index 8ef78c18..bad9d974 100644 --- a/include/beman/execution/detail/forwarding_query.hpp +++ b/include/beman/execution/detail/forwarding_query.hpp @@ -37,7 +37,7 @@ namespace beman::execution { * \brief Type of the forwarding_query customization point object * \headerfile beman/execution/execution.hpp */ -using forwarding_query_t = beman::execution::detail::forwarding_query_t; +BEMAN_EXECUTION_EXPORT using forwarding_query_t = beman::execution::detail::forwarding_query_t; /*! * \brief The customization point object to determine whether queries should be forwarded * \headerfile beman/execution/execution.hpp @@ -50,9 +50,9 @@ using forwarding_query_t = beman::execution::detail::forwarding_query_t; * * If the type of `q` is derived from `forwarding_query_t`. * * `false` otherwise. */ -inline constexpr forwarding_query_t forwarding_query{}; +BEMAN_EXECUTION_EXPORT inline constexpr forwarding_query_t forwarding_query{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_FORWARDING_QUERY diff --git a/include/beman/execution/detail/fwd_env.hpp b/include/beman/execution/detail/fwd_env.hpp index d0ef2d0b..9c6b27e2 100644 --- a/include/beman/execution/detail/fwd_env.hpp +++ b/include/beman/execution/detail/fwd_env.hpp @@ -48,4 +48,4 @@ fwd_env(Env&&) -> fwd_env; #include -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_FWD_ENV diff --git a/include/beman/execution/detail/gather_signatures.hpp b/include/beman/execution/detail/gather_signatures.hpp index 4232a100..70b8ff45 100644 --- a/include/beman/execution/detail/gather_signatures.hpp +++ b/include/beman/execution/detail/gather_signatures.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_GATHER_SIGNATURES #define INCLUDED_BEMAN_EXECUTION_DETAIL_GATHER_SIGNATURES +#include #include #include #include @@ -80,4 +81,4 @@ using gather_signatures = typename ::beman::execution::detail::gather_signatures // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_GATHER_SIGNATURES diff --git a/include/beman/execution/detail/get_allocator.hpp b/include/beman/execution/detail/get_allocator.hpp index be8947d0..dc54c3ac 100644 --- a/include/beman/execution/detail/get_allocator.hpp +++ b/include/beman/execution/detail/get_allocator.hpp @@ -15,7 +15,7 @@ // ---------------------------------------------------------------------------- namespace beman::execution { -struct get_allocator_t { +BEMAN_EXECUTION_EXPORT struct get_allocator_t { template requires(not requires(Object&& object, const get_allocator_t& tag) { ::std::as_const(object).query(tag); }) auto @@ -50,11 +50,11 @@ struct get_allocator_t { constexpr auto query(const ::beman::execution::forwarding_query_t&) const noexcept -> bool { return true; } }; -inline constexpr get_allocator_t get_allocator{}; +BEMAN_EXECUTION_EXPORT inline constexpr get_allocator_t get_allocator{}; } // namespace beman::execution // ---------------------------------------------------------------------------- #include -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_GET_ALLOCATOR diff --git a/include/beman/execution/detail/get_awaiter.hpp b/include/beman/execution/detail/get_awaiter.hpp index 6183d876..93678dfc 100644 --- a/include/beman/execution/detail/get_awaiter.hpp +++ b/include/beman/execution/detail/get_awaiter.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_GET_AWAITER #define INCLUDED_BEMAN_EXECUTION_DETAIL_GET_AWAITER +#include #include // ---------------------------------------------------------------------------- @@ -30,4 +31,4 @@ auto get_awaiter(Expr&& expr, Promise& promise) -> decltype(auto) { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_GET_AWAITER diff --git a/include/beman/execution/detail/get_completion_scheduler.hpp b/include/beman/execution/detail/get_completion_scheduler.hpp index 49ea89f7..517169dc 100644 --- a/include/beman/execution/detail/get_completion_scheduler.hpp +++ b/include/beman/execution/detail/get_completion_scheduler.hpp @@ -23,7 +23,7 @@ // ---------------------------------------------------------------------------- namespace beman::execution { -template +BEMAN_EXECUTION_EXPORT template struct get_completion_scheduler_t; template @@ -78,7 +78,7 @@ struct get_completion_scheduler_t : ::beman::execution::forwarding_query_t { } }; -template <::beman::execution::detail::completion_tag Tag> +BEMAN_EXECUTION_EXPORT template <::beman::execution::detail::completion_tag Tag> inline constexpr get_completion_scheduler_t get_completion_scheduler{}; } // namespace beman::execution @@ -86,4 +86,4 @@ inline constexpr get_completion_scheduler_t get_completion_scheduler{}; #include -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_GET_COMPLETION_SCHEDULER diff --git a/include/beman/execution/detail/get_completion_signatures.hpp b/include/beman/execution/detail/get_completion_signatures.hpp index 23d5e94a..330591f8 100644 --- a/include/beman/execution/detail/get_completion_signatures.hpp +++ b/include/beman/execution/detail/get_completion_signatures.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_GET_COMPLETION_SIGNATURES #define INCLUDED_BEMAN_EXECUTION_DETAIL_GET_COMPLETION_SIGNATURES +#include #include #include #include @@ -19,7 +20,7 @@ // ---------------------------------------------------------------------------- namespace beman::execution { -struct get_completion_signatures_t { +BEMAN_EXECUTION_EXPORT struct get_completion_signatures_t { private: template static auto get(Sender&& sender, Env&& env) noexcept { @@ -60,9 +61,9 @@ struct get_completion_signatures_t { return this->get(::std::forward(sender), ::std::forward(env)); } }; -inline constexpr get_completion_signatures_t get_completion_signatures{}; +BEMAN_EXECUTION_EXPORT inline constexpr get_completion_signatures_t get_completion_signatures{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_GET_COMPLETION_SIGNATURES diff --git a/include/beman/execution/detail/get_delegation_scheduler.hpp b/include/beman/execution/detail/get_delegation_scheduler.hpp index 394746f8..427d6086 100644 --- a/include/beman/execution/detail/get_delegation_scheduler.hpp +++ b/include/beman/execution/detail/get_delegation_scheduler.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_GET_DELEGATION_SCHEDULER #define INCLUDED_BEMAN_EXECUTION_DETAIL_GET_DELEGATION_SCHEDULER +#include #include #include #include @@ -11,7 +12,7 @@ // ---------------------------------------------------------------------------- namespace beman::execution { -struct get_delegation_scheduler_t { +BEMAN_EXECUTION_EXPORT struct get_delegation_scheduler_t { template requires requires(Env&& env, const get_delegation_scheduler_t& g) { { ::std::as_const(env).query(g) } noexcept -> ::beman::execution::scheduler; @@ -22,9 +23,9 @@ struct get_delegation_scheduler_t { constexpr auto query(const ::beman::execution::forwarding_query_t&) const noexcept -> bool { return true; } }; -inline constexpr get_delegation_scheduler_t get_delegation_scheduler{}; +BEMAN_EXECUTION_EXPORT inline constexpr get_delegation_scheduler_t get_delegation_scheduler{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_GET_DELEGATION_SCHEDULER diff --git a/include/beman/execution/detail/get_domain.hpp b/include/beman/execution/detail/get_domain.hpp index e0fb2e88..58daf7e3 100644 --- a/include/beman/execution/detail/get_domain.hpp +++ b/include/beman/execution/detail/get_domain.hpp @@ -13,7 +13,7 @@ // ---------------------------------------------------------------------------- namespace beman::execution { -struct get_domain_t { +BEMAN_EXECUTION_EXPORT struct get_domain_t { template requires(not requires(Object&& object, const get_domain_t& tag) { ::std::forward(object).query(tag); @@ -37,11 +37,11 @@ struct get_domain_t { constexpr auto query(const ::beman::execution::forwarding_query_t&) const noexcept -> bool { return true; } }; -inline constexpr get_domain_t get_domain{}; +BEMAN_EXECUTION_EXPORT inline constexpr get_domain_t get_domain{}; } // namespace beman::execution // ---------------------------------------------------------------------------- #include -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_GET_DOMAIN diff --git a/include/beman/execution/detail/get_domain_early.hpp b/include/beman/execution/detail/get_domain_early.hpp index 09b09161..fe617bb3 100644 --- a/include/beman/execution/detail/get_domain_early.hpp +++ b/include/beman/execution/detail/get_domain_early.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_GET_DOMAIN_EARLY #define INCLUDED_BEMAN_EXECUTION_DETAIL_GET_DOMAIN_EARLY +#include #include #include #include @@ -25,4 +26,4 @@ constexpr auto get_domain_early(const Sender& sender) noexcept { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_GET_DOMAIN_EARLY diff --git a/include/beman/execution/detail/get_domain_late.hpp b/include/beman/execution/detail/get_domain_late.hpp index c2a3f954..a716f352 100644 --- a/include/beman/execution/detail/get_domain_late.hpp +++ b/include/beman/execution/detail/get_domain_late.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_GET_DOMAIN_LATE #define INCLUDED_BEMAN_EXECUTION_DETAIL_GET_DOMAIN_LATE +#include #include #include #include @@ -58,4 +59,4 @@ constexpr auto get_domain_late(const Sender& sender, const Env& env) noexcept { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_GET_DOMAIN_LATE diff --git a/include/beman/execution/detail/get_env.hpp b/include/beman/execution/detail/get_env.hpp index 5d94ff15..718163df 100644 --- a/include/beman/execution/detail/get_env.hpp +++ b/include/beman/execution/detail/get_env.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_GET_ENV #define INCLUDED_BEMAN_EXECUTION_DETAIL_GET_ENV +#include #include #include #include @@ -12,7 +13,7 @@ // ---------------------------------------------------------------------------- namespace beman::execution { -struct get_env_t { +BEMAN_EXECUTION_EXPORT struct get_env_t { template requires(not requires(::std::add_const_t<::std::remove_cvref_t>& object) { object.get_env(); } || ::beman::execution::detail::queryable< @@ -30,9 +31,9 @@ struct get_env_t { } }; -inline constexpr get_env_t get_env{}; +BEMAN_EXECUTION_EXPORT inline constexpr get_env_t get_env{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_GET_ENV diff --git a/include/beman/execution/detail/get_scheduler.hpp b/include/beman/execution/detail/get_scheduler.hpp index 1e6fa60d..9daac011 100644 --- a/include/beman/execution/detail/get_scheduler.hpp +++ b/include/beman/execution/detail/get_scheduler.hpp @@ -4,13 +4,14 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_GET_SCHEDULER #define INCLUDED_BEMAN_EXECUTION_DETAIL_GET_SCHEDULER +#include #include #include // ---------------------------------------------------------------------------- namespace beman::execution { -struct get_scheduler_t : ::beman::execution::forwarding_query_t { +BEMAN_EXECUTION_EXPORT struct get_scheduler_t : ::beman::execution::forwarding_query_t { template requires requires(const get_scheduler_t& self, Env&& env) { ::std::as_const(env).query(self); } auto operator()(Env&& env) const noexcept { @@ -23,9 +24,9 @@ struct get_scheduler_t : ::beman::execution::forwarding_query_t { } }; -inline constexpr get_scheduler_t get_scheduler{}; +BEMAN_EXECUTION_EXPORT inline constexpr get_scheduler_t get_scheduler{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_GET_SCHEDULER diff --git a/include/beman/execution/detail/get_stop_token.hpp b/include/beman/execution/detail/get_stop_token.hpp index b88e5460..45d0278b 100644 --- a/include/beman/execution/detail/get_stop_token.hpp +++ b/include/beman/execution/detail/get_stop_token.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_GET_STOP_TOKEN #define INCLUDED_BEMAN_EXECUTION_DETAIL_GET_STOP_TOKEN +#include #include #include #include @@ -17,7 +18,7 @@ template concept decayed_stoppable_token = ::beman::execution::stoppable_token<::std::decay_t>; } namespace beman::execution { -struct get_stop_token_t { +BEMAN_EXECUTION_EXPORT struct get_stop_token_t { template requires requires(Object&& object, const get_stop_token_t& tag) { { ::std::as_const(object).query(tag) } noexcept -> ::beman::execution::detail::decayed_stoppable_token; @@ -34,9 +35,9 @@ struct get_stop_token_t { constexpr auto query(const ::beman::execution::forwarding_query_t&) const noexcept -> bool { return true; } }; -inline constexpr get_stop_token_t get_stop_token{}; +BEMAN_EXECUTION_EXPORT inline constexpr get_stop_token_t get_stop_token{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_GET_STOP_TOKEN diff --git a/include/beman/execution/detail/has_as_awaitable.hpp b/include/beman/execution/detail/has_as_awaitable.hpp index ade5d419..447bdaca 100644 --- a/include/beman/execution/detail/has_as_awaitable.hpp +++ b/include/beman/execution/detail/has_as_awaitable.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_HAS_AS_AWAITABLE #define INCLUDED_BEMAN_EXECUTION_DETAIL_HAS_AS_AWAITABLE +#include #include #include @@ -18,4 +19,4 @@ concept has_as_awaitable = requires(T&& obj, Promise& promise) { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_HAS_AS_AWAITABLE diff --git a/include/beman/execution/detail/has_completions.hpp b/include/beman/execution/detail/has_completions.hpp index d985859e..ec756ff6 100644 --- a/include/beman/execution/detail/has_completions.hpp +++ b/include/beman/execution/detail/has_completions.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_HAS_COMPLETIONS #define INCLUDED_BEMAN_EXECUTION_DETAIL_HAS_COMPLETIONS +#include #include #include @@ -34,4 +35,4 @@ concept has_completions = has_completions_aux::value; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_HAS_COMPLETIONS diff --git a/include/beman/execution/detail/immovable.hpp b/include/beman/execution/detail/immovable.hpp index 99275d89..138a7348 100644 --- a/include/beman/execution/detail/immovable.hpp +++ b/include/beman/execution/detail/immovable.hpp @@ -4,6 +4,8 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_IMMOVABLE #define INCLUDED_BEMAN_EXECUTION_DETAIL_IMMOVABLE +#include + // ---------------------------------------------------------------------------- namespace beman::execution::detail { @@ -31,4 +33,4 @@ struct beman::execution::detail::virtual_immovable { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_IMMOVABLE diff --git a/include/beman/execution/detail/impls_for.hpp b/include/beman/execution/detail/impls_for.hpp index 25d033e0..3da8cdde 100644 --- a/include/beman/execution/detail/impls_for.hpp +++ b/include/beman/execution/detail/impls_for.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_IMPLS_FOR #define INCLUDED_BEMAN_EXECUTION_DETAIL_IMPLS_FOR +#include #include // ---------------------------------------------------------------------------- @@ -15,4 +16,4 @@ struct impls_for : ::beman::execution::detail::default_impls {}; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_IMPLS_FOR diff --git a/include/beman/execution/detail/indices_for.hpp b/include/beman/execution/detail/indices_for.hpp index a87f1674..c5f9ce29 100644 --- a/include/beman/execution/detail/indices_for.hpp +++ b/include/beman/execution/detail/indices_for.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_INDICES_FOR #define INCLUDED_BEMAN_EXECUTION_DETAIL_INDICES_FOR +#include #include // ---------------------------------------------------------------------------- @@ -15,4 +16,4 @@ using indices_for = typename ::std::remove_reference_t::indices_for; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_INDICES_FOR diff --git a/include/beman/execution/detail/indirect_meta_apply.hpp b/include/beman/execution/detail/indirect_meta_apply.hpp index c73526a6..92be6108 100644 --- a/include/beman/execution/detail/indirect_meta_apply.hpp +++ b/include/beman/execution/detail/indirect_meta_apply.hpp @@ -4,6 +4,8 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_INDIRECT_META_APPLY #define INCLUDED_BEMAN_EXECUTION_DETAIL_INDIRECT_META_APPLY +#include + // ---------------------------------------------------------------------------- namespace beman::execution::detail { @@ -16,4 +18,4 @@ struct indirect_meta_apply { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_INDIRECT_META_APPLY diff --git a/include/beman/execution/detail/inplace_stop_source.hpp b/include/beman/execution/detail/inplace_stop_source.hpp index cf3f5c56..214f409f 100644 --- a/include/beman/execution/detail/inplace_stop_source.hpp +++ b/include/beman/execution/detail/inplace_stop_source.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_INPLACE_STOP_SOURCE #define INCLUDED_BEMAN_EXECUTION_DETAIL_INPLACE_STOP_SOURCE +#include #include #include #include @@ -14,11 +15,11 @@ // ---------------------------------------------------------------------------- namespace beman::execution { -class inplace_stop_token; -class inplace_stop_source; -template +BEMAN_EXECUTION_EXPORT class inplace_stop_token; +BEMAN_EXECUTION_EXPORT class inplace_stop_source; +BEMAN_EXECUTION_EXPORT template class inplace_stop_callback; -template +BEMAN_EXECUTION_EXPORT template inplace_stop_callback(::beman::execution::inplace_stop_token, CallbackFun) -> inplace_stop_callback; } // namespace beman::execution @@ -188,4 +189,4 @@ inline auto beman::execution::inplace_stop_callback::call() -> void // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_INPLACE_STOP_SOURCE diff --git a/include/beman/execution/detail/into_variant.hpp b/include/beman/execution/detail/into_variant.hpp index 52f58c5e..7905a582 100644 --- a/include/beman/execution/detail/into_variant.hpp +++ b/include/beman/execution/detail/into_variant.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_INTO_VARIANT #define INCLUDED_BEMAN_EXECUTION_DETAIL_INTO_VARIANT +#include #include #include #include @@ -29,7 +30,7 @@ // ---------------------------------------------------------------------------- namespace beman::execution::detail { -struct into_variant_t { +BEMAN_EXECUTION_EXPORT struct into_variant_t { template <::beman::execution::sender Sender> auto operator()(Sender&& sender) const { auto domain{::beman::execution::detail::get_domain_early(sender)}; @@ -93,10 +94,10 @@ struct completion_signatures_for_impl< } // namespace beman::execution::detail namespace beman::execution { -using into_variant_t = ::beman::execution::detail::into_variant_t; -inline constexpr into_variant_t into_variant{}; +BEMAN_EXECUTION_EXPORT using into_variant_t = ::beman::execution::detail::into_variant_t; +BEMAN_EXECUTION_EXPORT inline constexpr into_variant_t into_variant{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_INTO_VARIANT diff --git a/include/beman/execution/detail/intrusive_stack.hpp b/include/beman/execution/detail/intrusive_stack.hpp index c954bca5..43a09a11 100644 --- a/include/beman/execution/detail/intrusive_stack.hpp +++ b/include/beman/execution/detail/intrusive_stack.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_INTRUSIVE_QUEUE #define INCLUDED_BEMAN_EXECUTION_DETAIL_INTRUSIVE_QUEUE +#include #include #include @@ -44,4 +45,4 @@ class intrusive_stack { } // namespace beman::execution::detail -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_INTRUSIVE_QUEUE diff --git a/include/beman/execution/detail/is_awaitable.hpp b/include/beman/execution/detail/is_awaitable.hpp index 41ccb427..5d13b0d1 100644 --- a/include/beman/execution/detail/is_awaitable.hpp +++ b/include/beman/execution/detail/is_awaitable.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_IS_AWAITABLE #define INCLUDED_BEMAN_EXECUTION_DETAIL_IS_AWAITABLE +#include #include #include #include @@ -21,4 +22,4 @@ concept is_awaitable = requires(Promise& promise) { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_IS_AWAITABLE diff --git a/include/beman/execution/detail/is_awaiter.hpp b/include/beman/execution/detail/is_awaiter.hpp index c37c5d8d..e1efcd83 100644 --- a/include/beman/execution/detail/is_awaiter.hpp +++ b/include/beman/execution/detail/is_awaiter.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_IS_AWAITER #define INCLUDED_BEMAN_EXECUTION_DETAIL_IS_AWAITER +#include #include #include @@ -20,4 +21,4 @@ concept is_awaiter = requires(Awaiter& awaiter, ::std::coroutine_handle // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_IS_AWAITER diff --git a/include/beman/execution/detail/join_env.hpp b/include/beman/execution/detail/join_env.hpp index f5d0d27b..01ee4592 100644 --- a/include/beman/execution/detail/join_env.hpp +++ b/include/beman/execution/detail/join_env.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_JOIN_ENV #define INCLUDED_BEMAN_EXECUTION_DETAIL_JOIN_ENV +#include #include #include @@ -56,4 +57,4 @@ join_env(Env1&&, Env2&&) -> join_env<::std::remove_cvref_t, ::std::remove_ // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_JOIN_ENV diff --git a/include/beman/execution/detail/just.hpp b/include/beman/execution/detail/just.hpp index 8cd1af59..495697a9 100644 --- a/include/beman/execution/detail/just.hpp +++ b/include/beman/execution/detail/just.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_JUST #define INCLUDED_BEMAN_EXECUTION_DETAIL_JUST +#include #include #include #include @@ -60,9 +61,9 @@ struct impls_for> : ::beman::execution::detail::default_impls #include namespace beman::execution { -using just_t = ::beman::execution::detail::just_t<::beman::execution::set_value_t>; -using just_error_t = ::beman::execution::detail::just_t<::beman::execution::set_error_t>; -using just_stopped_t = ::beman::execution::detail::just_t<::beman::execution::set_stopped_t>; +BEMAN_EXECUTION_EXPORT using just_t = ::beman::execution::detail::just_t<::beman::execution::set_value_t>; +BEMAN_EXECUTION_EXPORT using just_error_t = ::beman::execution::detail::just_t<::beman::execution::set_error_t>; +BEMAN_EXECUTION_EXPORT using just_stopped_t = ::beman::execution::detail::just_t<::beman::execution::set_stopped_t>; /*! * \brief just(_arg_...) yields a sender completing with set_value_t(_Arg_...) @@ -113,7 +114,7 @@ using just_stopped_t = ::beman::execution::detail::just_t<::beman::execution::se * } * */ -inline constexpr ::beman::execution::just_t just{}; +BEMAN_EXECUTION_EXPORT inline constexpr ::beman::execution::just_t just{}; /*! * \brief just_error(_error_) yields a sender completing with set_error_t(_Error_) @@ -171,7 +172,7 @@ inline constexpr ::beman::execution::just_t just{}; * } * */ -inline constexpr ::beman::execution::just_error_t just_error{}; +BEMAN_EXECUTION_EXPORT inline constexpr ::beman::execution::just_error_t just_error{}; /*! * \brief just_stopped() yields a sender completing with set_stopped_t() @@ -225,9 +226,9 @@ inline constexpr ::beman::execution::just_error_t just_error{}; * } * */ -inline constexpr ::beman::execution::just_stopped_t just_stopped{}; +BEMAN_EXECUTION_EXPORT inline constexpr ::beman::execution::just_stopped_t just_stopped{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_JUST diff --git a/include/beman/execution/detail/let.hpp b/include/beman/execution/detail/let.hpp index e8102be4..60448fb7 100644 --- a/include/beman/execution/detail/let.hpp +++ b/include/beman/execution/detail/let.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_LET #define INCLUDED_BEMAN_EXECUTION_DETAIL_LET +#include #include #include #include @@ -235,15 +236,15 @@ struct completion_signatures_for_impl< #include namespace beman::execution { -using let_error_t = ::beman::execution::detail::let_t<::beman::execution::set_error_t>; -using let_stopped_t = ::beman::execution::detail::let_t<::beman::execution::set_stopped_t>; -using let_value_t = ::beman::execution::detail::let_t<::beman::execution::set_value_t>; +BEMAN_EXECUTION_EXPORT using let_error_t = ::beman::execution::detail::let_t<::beman::execution::set_error_t>; +BEMAN_EXECUTION_EXPORT using let_stopped_t = ::beman::execution::detail::let_t<::beman::execution::set_stopped_t>; +BEMAN_EXECUTION_EXPORT using let_value_t = ::beman::execution::detail::let_t<::beman::execution::set_value_t>; -inline constexpr ::beman::execution::let_error_t let_error{}; -inline constexpr ::beman::execution::let_stopped_t let_stopped{}; -inline constexpr ::beman::execution::let_value_t let_value{}; +BEMAN_EXECUTION_EXPORT inline constexpr ::beman::execution::let_error_t let_error{}; +BEMAN_EXECUTION_EXPORT inline constexpr ::beman::execution::let_stopped_t let_stopped{}; +BEMAN_EXECUTION_EXPORT inline constexpr ::beman::execution::let_value_t let_value{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_LET diff --git a/include/beman/execution/detail/make_env.hpp b/include/beman/execution/detail/make_env.hpp index 533d6da0..1d92d9aa 100644 --- a/include/beman/execution/detail/make_env.hpp +++ b/include/beman/execution/detail/make_env.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_MAKE_ENV #define INCLUDED_BEMAN_EXECUTION_DETAIL_MAKE_ENV +#include #include #include @@ -27,4 +28,4 @@ make_env(Query&&, Value&& value) -> make_env<::std::remove_cvref_t, ::std // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_MAKE_ENV diff --git a/include/beman/execution/detail/make_sender.hpp b/include/beman/execution/detail/make_sender.hpp index 1a1a8408..4671ce65 100644 --- a/include/beman/execution/detail/make_sender.hpp +++ b/include/beman/execution/detail/make_sender.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_MAKE_SENDER #define INCLUDED_BEMAN_EXECUTION_DETAIL_MAKE_SENDER +#include #include #include #include @@ -30,4 +31,4 @@ constexpr auto make_sender(Tag tag, Data&& data, Child&&... child) { #include -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_MAKE_SENDER diff --git a/include/beman/execution/detail/matching_sig.hpp b/include/beman/execution/detail/matching_sig.hpp index 8da06b00..f137bbbc 100644 --- a/include/beman/execution/detail/matching_sig.hpp +++ b/include/beman/execution/detail/matching_sig.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_MATCHING_SIG #define INCLUDED_BEMAN_EXECUTION_DETAIL_MATCHING_SIG +#include #include // ---------------------------------------------------------------------------- @@ -26,4 +27,4 @@ inline constexpr bool matching_sig = // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_MATCHING_SIG diff --git a/include/beman/execution/detail/meta_combine.hpp b/include/beman/execution/detail/meta_combine.hpp index 5b110982..e7b9c85f 100644 --- a/include/beman/execution/detail/meta_combine.hpp +++ b/include/beman/execution/detail/meta_combine.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_META_COMBINE #define INCLUDED_BEMAN_EXECUTION_DETAIL_META_COMBINE +#include #include #include @@ -34,4 +35,4 @@ using combine = typename ::beman::execution::detail::meta::detail::combine // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_META_COMBINE diff --git a/include/beman/execution/detail/meta_contain_same.hpp b/include/beman/execution/detail/meta_contain_same.hpp index c5874e8d..e23e6543 100644 --- a/include/beman/execution/detail/meta_contain_same.hpp +++ b/include/beman/execution/detail/meta_contain_same.hpp @@ -1,9 +1,10 @@ // include/beman/execution/detail/meta_contain_same.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_META_CONTAIN_SAME -#define INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_META_CONTAIN_SAME +#ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_META_CONTAIN_SAME +#define INCLUDED_BEMAN_EXECUTION_DETAIL_META_CONTAIN_SAME +#include #include // ---------------------------------------------------------------------------- @@ -24,4 +25,4 @@ inline constexpr bool contain_same = contain_same_t::value; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_META_CONTAIN_SAME diff --git a/include/beman/execution/detail/meta_contains.hpp b/include/beman/execution/detail/meta_contains.hpp index cc97e055..b41d5918 100644 --- a/include/beman/execution/detail/meta_contains.hpp +++ b/include/beman/execution/detail/meta_contains.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_META_CONTAINS #define INCLUDED_BEMAN_EXECUTION_DETAIL_META_CONTAINS +#include #include // ---------------------------------------------------------------------------- @@ -15,4 +16,4 @@ inline constexpr bool contains{(::std::same_as || ...)}; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_META_CONTAINS diff --git a/include/beman/execution/detail/meta_filter.hpp b/include/beman/execution/detail/meta_filter.hpp index 810a5bde..dec3bacc 100644 --- a/include/beman/execution/detail/meta_filter.hpp +++ b/include/beman/execution/detail/meta_filter.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_META_FILTER #define INCLUDED_BEMAN_EXECUTION_DETAIL_META_FILTER +#include #include #include @@ -54,4 +55,4 @@ using filter_tag = typename ::beman::execution::detail::meta::detail::filter_tag // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_META_FILTER diff --git a/include/beman/execution/detail/meta_prepend.hpp b/include/beman/execution/detail/meta_prepend.hpp index 7d7f3033..188ff9c4 100644 --- a/include/beman/execution/detail/meta_prepend.hpp +++ b/include/beman/execution/detail/meta_prepend.hpp @@ -4,6 +4,8 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_META_PREPEND #define INCLUDED_BEMAN_EXECUTION_DETAIL_META_PREPEND +#include + // ---------------------------------------------------------------------------- namespace beman::execution::detail::meta::detail { @@ -23,4 +25,4 @@ using prepend = typename ::beman::execution::detail::meta::detail::prepend #include // ---------------------------------------------------------------------------- @@ -21,4 +22,4 @@ inline constexpr ::std::size_t size_v{::beman::execution::detail::meta::size: // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_META_SIZE diff --git a/include/beman/execution/detail/meta_to.hpp b/include/beman/execution/detail/meta_to.hpp index 65679c62..b1c5f8ff 100644 --- a/include/beman/execution/detail/meta_to.hpp +++ b/include/beman/execution/detail/meta_to.hpp @@ -4,6 +4,8 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_META_TO #define INCLUDED_BEMAN_EXECUTION_DETAIL_META_TO +#include + // ---------------------------------------------------------------------------- namespace beman::execution::detail::meta { @@ -19,4 +21,4 @@ using to = typename ::beman::execution::detail::meta::to_type_list::type; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_META_TO diff --git a/include/beman/execution/detail/meta_transform.hpp b/include/beman/execution/detail/meta_transform.hpp index 3003ac4e..bd2ee542 100644 --- a/include/beman/execution/detail/meta_transform.hpp +++ b/include/beman/execution/detail/meta_transform.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_META_TRANSFORM #define INCLUDED_BEMAN_EXECUTION_DETAIL_META_TRANSFORM +#include #include // ---------------------------------------------------------------------------- @@ -25,4 +26,4 @@ using transform = typename ::beman::execution::detail::meta::detail::transform #include #include #include @@ -42,4 +43,4 @@ using unique = typename ::beman::execution::detail::meta::detail::unique::typ // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_META_UNIQUE diff --git a/include/beman/execution/detail/movable_value.hpp b/include/beman/execution/detail/movable_value.hpp index 7dd0a214..18a88527 100644 --- a/include/beman/execution/detail/movable_value.hpp +++ b/include/beman/execution/detail/movable_value.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_MOVABLE_VALUE #define INCLUDED_BEMAN_EXECUTION_DETAIL_MOVABLE_VALUE +#include #include #include @@ -18,4 +19,4 @@ concept movable_value = // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_MOVABLE_VALUE diff --git a/include/beman/execution/detail/nested_sender_has_affine_on.hpp b/include/beman/execution/detail/nested_sender_has_affine_on.hpp index be374edc..2c5f8e53 100644 --- a/include/beman/execution/detail/nested_sender_has_affine_on.hpp +++ b/include/beman/execution/detail/nested_sender_has_affine_on.hpp @@ -1,9 +1,10 @@ // include/beman/execution/detail/nested_sender_has_affine_on.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_NESTED_SENDER_HAS_AFFINE_ON -#define INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_NESTED_SENDER_HAS_AFFINE_ON +#ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_NESTED_SENDER_HAS_AFFINE_ON +#define INCLUDED_BEMAN_EXECUTION_DETAIL_NESTED_SENDER_HAS_AFFINE_ON +#include #include // ---------------------------------------------------------------------------- @@ -17,4 +18,4 @@ concept nested_sender_has_affine_on = requires(Sender&& sndr, const Env& env) { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_NESTED_SENDER_HAS_AFFINE_ON diff --git a/include/beman/execution/detail/never_stop_token.hpp b/include/beman/execution/detail/never_stop_token.hpp index 8bec760b..003f2b17 100644 --- a/include/beman/execution/detail/never_stop_token.hpp +++ b/include/beman/execution/detail/never_stop_token.hpp @@ -4,10 +4,12 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_NEVER_STOP_TOKEN #define INCLUDED_BEMAN_EXECUTION_DETAIL_NEVER_STOP_TOKEN +#include + // ---------------------------------------------------------------------------- namespace beman::execution { -class never_stop_token; +BEMAN_EXECUTION_EXPORT class never_stop_token; } // ---------------------------------------------------------------------------- @@ -28,4 +30,4 @@ class beman::execution::never_stop_token { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_NEVER_STOP_TOKEN diff --git a/include/beman/execution/detail/non_assignable.hpp b/include/beman/execution/detail/non_assignable.hpp index b2f9caa4..5232af87 100644 --- a/include/beman/execution/detail/non_assignable.hpp +++ b/include/beman/execution/detail/non_assignable.hpp @@ -1,8 +1,10 @@ // include/beman/execution/detail/non_assignable.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_NON_ASSIGNABLE -#define INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_NON_ASSIGNABLE +#ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_NON_ASSIGNABLE +#define INCLUDED_BEMAN_EXECUTION_DETAIL_NON_ASSIGNABLE + +#include // ---------------------------------------------------------------------------- @@ -22,4 +24,4 @@ struct beman::execution::detail::non_assignable { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_NON_ASSIGNABLE diff --git a/include/beman/execution/detail/nostopstate.hpp b/include/beman/execution/detail/nostopstate.hpp index ad485790..b4763343 100644 --- a/include/beman/execution/detail/nostopstate.hpp +++ b/include/beman/execution/detail/nostopstate.hpp @@ -4,16 +4,18 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_NOSTOPSTATE #define INCLUDED_BEMAN_EXECUTION_DETAIL_NOSTOPSTATE +#include + // ---------------------------------------------------------------------------- namespace beman::execution { -struct nostopstate_t { +BEMAN_EXECUTION_EXPORT struct nostopstate_t { explicit nostopstate_t() = default; }; -inline constexpr nostopstate_t nostopstate{}; +BEMAN_EXECUTION_EXPORT inline constexpr nostopstate_t nostopstate{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_NOSTOPSTATE diff --git a/include/beman/execution/detail/nothrow_callable.hpp b/include/beman/execution/detail/nothrow_callable.hpp index 4826841f..df9ea417 100644 --- a/include/beman/execution/detail/nothrow_callable.hpp +++ b/include/beman/execution/detail/nothrow_callable.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_NOTHROW_CALLABLE #define INCLUDED_BEMAN_EXECUTION_DETAIL_NOTHROW_CALLABLE +#include #include // ---------------------------------------------------------------------------- @@ -17,4 +18,4 @@ concept nothrow_callable = ::beman::execution::detail::callable && // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_NOTHROW_CALLABLE diff --git a/include/beman/execution/detail/notify.hpp b/include/beman/execution/detail/notify.hpp index 6ffb2787..ae08fd8a 100644 --- a/include/beman/execution/detail/notify.hpp +++ b/include/beman/execution/detail/notify.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_NOTIFY #define INCLUDED_BEMAN_EXECUTION_DETAIL_NOTIFY +#include #include #include #include @@ -83,4 +84,4 @@ struct completion_signatures_for_impl< // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_NOTIFY diff --git a/include/beman/execution/detail/on.hpp b/include/beman/execution/detail/on.hpp index 197419d9..6038e756 100644 --- a/include/beman/execution/detail/on.hpp +++ b/include/beman/execution/detail/on.hpp @@ -1,9 +1,10 @@ // include/beman/execution/detail/on.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_ON -#define INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_ON +#ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_ON +#define INCLUDED_BEMAN_EXECUTION_DETAIL_ON +#include #include #include #include @@ -132,37 +133,15 @@ struct on_t : ::beman::execution::sender_adaptor_closure { } }; -#if 0 -template -struct completion_signatures_for_impl< - ::beman::execution::detail::basic_sender<::beman::execution::detail::on_t, Data, Sender>, - Env> { - //-dk:TODO pick up scheduler errors and merge them in? - using type = -#if 0 - ::beman::execution::detail::meta::combine< - ::beman::execution::completion_signatures_of_t, - ::beman::execution::completion_signatures<::beman::execution::set_error_t(::std::exception_ptr)> - > -#else - ::beman::execution::completion_signatures< - ::beman::execution::set_value_t(), - ::beman::execution::set_error_t(::std::exception_ptr) - > -#endif - ; -}; -#endif - } // namespace beman::execution::detail namespace beman::execution { -using on_t = ::beman::execution::detail::on_t; -inline constexpr ::beman::execution::on_t on{}; +BEMAN_EXECUTION_EXPORT using on_t = ::beman::execution::detail::on_t; +BEMAN_EXECUTION_EXPORT inline constexpr ::beman::execution::on_t on{}; } // namespace beman::execution // ---------------------------------------------------------------------------- #include -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_ON diff --git a/include/beman/execution/detail/on_stop_request.hpp b/include/beman/execution/detail/on_stop_request.hpp index 4a8c86c3..9554706d 100644 --- a/include/beman/execution/detail/on_stop_request.hpp +++ b/include/beman/execution/detail/on_stop_request.hpp @@ -4,6 +4,8 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_ON_STOP_REQUEST #define INCLUDED_BEMAN_EXECUTION_DETAIL_ON_STOP_REQUEST +#include + // ---------------------------------------------------------------------------- namespace beman::execution::detail { @@ -18,4 +20,4 @@ on_stop_request(T&) -> on_stop_request; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_ON_STOP_REQUEST diff --git a/include/beman/execution/detail/operation_state.hpp b/include/beman/execution/detail/operation_state.hpp index 63971cb9..d1a9a2a8 100644 --- a/include/beman/execution/detail/operation_state.hpp +++ b/include/beman/execution/detail/operation_state.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_OPERATION_STATE #define INCLUDED_BEMAN_EXECUTION_DETAIL_OPERATION_STATE +#include #include #include #include @@ -11,9 +12,9 @@ // ---------------------------------------------------------------------------- namespace beman::execution { -struct operation_state_t {}; +BEMAN_EXECUTION_EXPORT struct operation_state_t {}; -template +BEMAN_EXECUTION_EXPORT template concept operation_state = ::std::derived_from && ::std::is_object_v && requires(State& state) { @@ -23,4 +24,4 @@ concept operation_state = // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_OPERATION_STATE diff --git a/include/beman/execution/detail/operation_state_task.hpp b/include/beman/execution/detail/operation_state_task.hpp index 3b14088d..7d38bd84 100644 --- a/include/beman/execution/detail/operation_state_task.hpp +++ b/include/beman/execution/detail/operation_state_task.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_OPERATION_STATE_TASK #define INCLUDED_BEMAN_EXECUTION_DETAIL_OPERATION_STATE_TASK +#include #include #include #include @@ -82,4 +83,4 @@ auto beman::execution::detail::connect_awaitable_promise::get_return_o // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_OPERATION_STATE_TASK diff --git a/include/beman/execution/detail/product_type.hpp b/include/beman/execution/detail/product_type.hpp index 59c4f395..b3951e61 100644 --- a/include/beman/execution/detail/product_type.hpp +++ b/include/beman/execution/detail/product_type.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_PRODUCT_TYPE #define INCLUDED_BEMAN_EXECUTION_DETAIL_PRODUCT_TYPE +#include #include #include @@ -93,12 +94,8 @@ struct product_type : ::beman::execution::detail::product_type_base<::std::index } template constexpr auto apply_elements(::std::index_sequence, Fun&& fun) -> decltype(auto) { -#if 0 - return ::std::forward(fun)(this->template get()...); -#else //-dk:TODO provide rvalue, lvalue, const lvalue overloads? return ::std::forward(fun)(std::move(this->template get())...); -#endif } template constexpr auto apply(Fun&& fun) -> decltype(auto) { @@ -149,4 +146,4 @@ struct tuple_element { #include -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_PRODUCT_TYPE diff --git a/include/beman/execution/detail/prop.hpp b/include/beman/execution/detail/prop.hpp index 56d23476..c5086bec 100644 --- a/include/beman/execution/detail/prop.hpp +++ b/include/beman/execution/detail/prop.hpp @@ -1,9 +1,10 @@ // include/beman/execution/detail/prop.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_PROP -#define INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_PROP +#ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_PROP +#define INCLUDED_BEMAN_EXECUTION_DETAIL_PROP +#include #include #include #include @@ -16,7 +17,7 @@ struct prop_like; } namespace beman::execution { -template +BEMAN_EXECUTION_EXPORT template struct prop; template @@ -47,4 +48,4 @@ struct beman::execution::prop { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_PROP diff --git a/include/beman/execution/detail/query_with_default.hpp b/include/beman/execution/detail/query_with_default.hpp index d61f0978..5f648889 100644 --- a/include/beman/execution/detail/query_with_default.hpp +++ b/include/beman/execution/detail/query_with_default.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_QUERY_WITH_DEFAULT #define INCLUDED_BEMAN_EXECUTION_DETAIL_QUERY_WITH_DEFAULT +#include #include // ---------------------------------------------------------------------------- @@ -25,4 +26,4 @@ query_with_default(Tag, const Env&, Value&& value) noexcept(noexcept(static_cast // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_QUERY_WITH_DEFAULT diff --git a/include/beman/execution/detail/queryable.hpp b/include/beman/execution/detail/queryable.hpp index d94a51f1..7ce66b07 100644 --- a/include/beman/execution/detail/queryable.hpp +++ b/include/beman/execution/detail/queryable.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_QUERYABLE #define INCLUDED_BEMAN_EXECUTION_DETAIL_QUERYABLE +#include #include // ---------------------------------------------------------------------------- @@ -15,4 +16,4 @@ concept queryable = ::std::destructible; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_QUERYABLE diff --git a/include/beman/execution/detail/read_env.hpp b/include/beman/execution/detail/read_env.hpp index 5b96137b..020319f6 100644 --- a/include/beman/execution/detail/read_env.hpp +++ b/include/beman/execution/detail/read_env.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_READ_ENV #define INCLUDED_BEMAN_EXECUTION_DETAIL_READ_ENV +#include #include #include #include @@ -53,10 +54,10 @@ struct completion_signatures_for_impl< } // namespace beman::execution::detail namespace beman::execution { -using read_env_t = beman::execution::detail::read_env_t; -inline constexpr read_env_t read_env{}; +BEMAN_EXECUTION_EXPORT using read_env_t = beman::execution::detail::read_env_t; +BEMAN_EXECUTION_EXPORT inline constexpr read_env_t read_env{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_READ_ENV diff --git a/include/beman/execution/detail/receiver.hpp b/include/beman/execution/detail/receiver.hpp index e1eb259b..a05ed1ee 100644 --- a/include/beman/execution/detail/receiver.hpp +++ b/include/beman/execution/detail/receiver.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_RECEIVER #define INCLUDED_BEMAN_EXECUTION_DETAIL_RECEIVER +#include #include #include #include @@ -12,9 +13,9 @@ // ---------------------------------------------------------------------------- namespace beman::execution { -struct receiver_t {}; +BEMAN_EXECUTION_EXPORT struct receiver_t {}; -template +BEMAN_EXECUTION_EXPORT template concept receiver = ::std::derived_from::receiver_concept, ::beman::execution::receiver_t> && requires(const ::std::remove_cvref_t& rcvr) { @@ -25,4 +26,4 @@ concept receiver = // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_RECEIVER diff --git a/include/beman/execution/detail/receiver_of.hpp b/include/beman/execution/detail/receiver_of.hpp index 90586081..dc0be306 100644 --- a/include/beman/execution/detail/receiver_of.hpp +++ b/include/beman/execution/detail/receiver_of.hpp @@ -4,18 +4,18 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_RECEIVER_OF #define INCLUDED_BEMAN_EXECUTION_DETAIL_RECEIVER_OF +#include #include #include // ---------------------------------------------------------------------------- namespace beman::execution { -template +BEMAN_EXECUTION_EXPORT template concept receiver_of = beman::execution::receiver && beman::execution::detail::has_completions; - } // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_RECEIVER_OF diff --git a/include/beman/execution/detail/run_loop.hpp b/include/beman/execution/detail/run_loop.hpp index 4a1f8796..2799ff0f 100644 --- a/include/beman/execution/detail/run_loop.hpp +++ b/include/beman/execution/detail/run_loop.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_RUN_LOOP #define INCLUDED_BEMAN_EXECUTION_DETAIL_RUN_LOOP +#include #include #include #include @@ -25,7 +26,7 @@ // ---------------------------------------------------------------------------- namespace beman::execution { -class run_loop { +BEMAN_EXECUTION_EXPORT class run_loop { private: struct scheduler; @@ -158,4 +159,4 @@ class run_loop { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_RUN_LOOP diff --git a/include/beman/execution/detail/sched_attrs.hpp b/include/beman/execution/detail/sched_attrs.hpp index 5d8e8372..a3667ce7 100644 --- a/include/beman/execution/detail/sched_attrs.hpp +++ b/include/beman/execution/detail/sched_attrs.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SCHED_ATTRS #define INCLUDED_BEMAN_EXECUTION_DETAIL_SCHED_ATTRS +#include #include #include #include @@ -45,4 +46,4 @@ sched_attrs(Scheduler&&) -> sched_attrs<::std::remove_cvref_t>; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SCHED_ATTRS diff --git a/include/beman/execution/detail/sched_env.hpp b/include/beman/execution/detail/sched_env.hpp index 8179ae2f..2e466d3d 100644 --- a/include/beman/execution/detail/sched_env.hpp +++ b/include/beman/execution/detail/sched_env.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SCHED_ENV #define INCLUDED_BEMAN_EXECUTION_DETAIL_SCHED_ENV +#include #include #include #include @@ -37,4 +38,4 @@ sched_env(Scheduler&&) -> sched_env<::std::remove_cvref_t>; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SCHED_ENV diff --git a/include/beman/execution/detail/schedule.hpp b/include/beman/execution/detail/schedule.hpp index 6dd4cff8..25e54591 100644 --- a/include/beman/execution/detail/schedule.hpp +++ b/include/beman/execution/detail/schedule.hpp @@ -4,8 +4,8 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SCHEDULE #define INCLUDED_BEMAN_EXECUTION_DETAIL_SCHEDULE -#include #include +#include #include #include @@ -13,7 +13,7 @@ // ---------------------------------------------------------------------------- namespace beman::execution { -struct schedule_t { +BEMAN_EXECUTION_EXPORT struct schedule_t { template requires(not requires(Scheduler&& sched) { { ::std::forward(sched).schedule() } -> ::beman::execution::sender; @@ -30,11 +30,11 @@ struct schedule_t { } }; -inline constexpr ::beman::execution::schedule_t schedule{}; +BEMAN_EXECUTION_EXPORT inline constexpr ::beman::execution::schedule_t schedule{}; } // namespace beman::execution // ---------------------------------------------------------------------------- #include -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SCHEDULE diff --git a/include/beman/execution/detail/schedule_from.hpp b/include/beman/execution/detail/schedule_from.hpp index 47a5b763..195b1aab 100644 --- a/include/beman/execution/detail/schedule_from.hpp +++ b/include/beman/execution/detail/schedule_from.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SCHEDULE_FROM #define INCLUDED_BEMAN_EXECUTION_DETAIL_SCHEDULE_FROM +#include #include #include #include @@ -180,10 +181,10 @@ struct completion_signatures_for_impl< } // namespace beman::execution::detail namespace beman::execution { -using schedule_from_t = beman::execution::detail::schedule_from_t; -inline constexpr ::beman::execution::schedule_from_t schedule_from{}; +BEMAN_EXECUTION_EXPORT using schedule_from_t = beman::execution::detail::schedule_from_t; +BEMAN_EXECUTION_EXPORT inline constexpr ::beman::execution::schedule_from_t schedule_from{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SCHEDULE_FROM diff --git a/include/beman/execution/detail/schedule_result_t.hpp b/include/beman/execution/detail/schedule_result_t.hpp index 8c995e7f..1f7b7a88 100644 --- a/include/beman/execution/detail/schedule_result_t.hpp +++ b/include/beman/execution/detail/schedule_result_t.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SCHEDULE_RESULT #define INCLUDED_BEMAN_EXECUTION_DETAIL_SCHEDULE_RESULT +#include #include #include #include @@ -11,10 +12,10 @@ // ---------------------------------------------------------------------------- namespace beman::execution { -template <::beman::execution::scheduler Scheduler> +BEMAN_EXECUTION_EXPORT template <::beman::execution::scheduler Scheduler> using schedule_result_t = decltype(::beman::execution::schedule(::std::declval())); } // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SCHEDULE_RESULT diff --git a/include/beman/execution/detail/scheduler.hpp b/include/beman/execution/detail/scheduler.hpp index d3090a86..71ae0bc8 100644 --- a/include/beman/execution/detail/scheduler.hpp +++ b/include/beman/execution/detail/scheduler.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SCHEDULER #define INCLUDED_BEMAN_EXECUTION_DETAIL_SCHEDULER +#include #include #include #include @@ -16,7 +17,7 @@ // ---------------------------------------------------------------------------- namespace beman::execution { -template +BEMAN_EXECUTION_EXPORT template concept scheduler = ::beman::execution::detail::almost_scheduler && requires(Scheduler&& sched) { { ::beman::execution::get_completion_scheduler<::beman::execution::set_value_t>( @@ -27,4 +28,4 @@ concept scheduler = ::beman::execution::detail::almost_scheduler && r // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SCHEDULER diff --git a/include/beman/execution/detail/scheduler_t.hpp b/include/beman/execution/detail/scheduler_t.hpp index 73623b5a..2765f271 100644 --- a/include/beman/execution/detail/scheduler_t.hpp +++ b/include/beman/execution/detail/scheduler_t.hpp @@ -4,6 +4,8 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SCHEDULER_T #define INCLUDED_BEMAN_EXECUTION_DETAIL_SCHEDULER_T +#include + // ---------------------------------------------------------------------------- namespace beman::execution { @@ -11,9 +13,9 @@ namespace beman::execution { * \brief Tag type to indicate a class is a scheduler. * \headerfile beman/execution/execution.hpp */ -struct scheduler_t {}; +BEMAN_EXECUTION_EXPORT struct scheduler_t {}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SCHEDULER_T diff --git a/include/beman/execution/detail/scope_token.hpp b/include/beman/execution/detail/scope_token.hpp index b0c0984f..1e5b0fe6 100644 --- a/include/beman/execution/detail/scope_token.hpp +++ b/include/beman/execution/detail/scope_token.hpp @@ -1,9 +1,10 @@ // include/beman/execution/detail/scope_token.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_SCOPE_TOKEN -#define INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_SCOPE_TOKEN +#ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SCOPE_TOKEN +#define INCLUDED_BEMAN_EXECUTION_DETAIL_SCOPE_TOKEN +#include #include #include #include @@ -28,7 +29,7 @@ static_assert(::beman::execution::sender_in<::beman::execution::detail::token_te } // namespace beman::execution::detail namespace beman::execution { -template +BEMAN_EXECUTION_EXPORT template concept scope_token = ::std::copyable && requires(Token token) { { token.try_associate() } -> ::std::same_as; { token.disassociate() } noexcept; @@ -40,4 +41,4 @@ concept scope_token = ::std::copyable && requires(Token token) { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SCOPE_TOKEN diff --git a/include/beman/execution/detail/sender.hpp b/include/beman/execution/detail/sender.hpp index d9dcf27f..1633d1fc 100644 --- a/include/beman/execution/detail/sender.hpp +++ b/include/beman/execution/detail/sender.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER #define INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER +#include #include #include #include @@ -15,7 +16,7 @@ // ---------------------------------------------------------------------------- namespace beman::execution { -struct sender_t {}; +BEMAN_EXECUTION_EXPORT struct sender_t {}; } // namespace beman::execution namespace beman::execution::detail { template @@ -28,7 +29,7 @@ concept enable_sender = ::beman::execution::detail::env_promise<::beman::execution::env<>>>; } // namespace beman::execution::detail namespace beman::execution { -template +BEMAN_EXECUTION_EXPORT template concept sender = ::beman::execution::detail::enable_sender<::std::remove_cvref_t> && requires(const ::std::remove_cvref_t& sndr) { { ::beman::execution::get_env(sndr) } -> ::beman::execution::detail::queryable; @@ -38,4 +39,4 @@ concept sender = ::beman::execution::detail::enable_sender<::std::remove_cvref_t // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER diff --git a/include/beman/execution/detail/sender_adaptor.hpp b/include/beman/execution/detail/sender_adaptor.hpp index be090eb8..560c6d34 100644 --- a/include/beman/execution/detail/sender_adaptor.hpp +++ b/include/beman/execution/detail/sender_adaptor.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER_ADAPTOR #define INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER_ADAPTOR +#include #include #include #include @@ -41,4 +42,4 @@ sender_adaptor(T&&...) -> sender_adaptor; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER_ADAPTOR diff --git a/include/beman/execution/detail/sender_adaptor_closure.hpp b/include/beman/execution/detail/sender_adaptor_closure.hpp index 8f82aa05..1974093c 100644 --- a/include/beman/execution/detail/sender_adaptor_closure.hpp +++ b/include/beman/execution/detail/sender_adaptor_closure.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER_ADAPTOR_CLOSURE #define INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER_ADAPTOR_CLOSURE +#include #include #include #include @@ -17,7 +18,7 @@ struct sender_adaptor_closure_base {}; namespace beman::execution { // NOLINTBEGIN(bugprone-crtp-constructor-accessibility) -template +BEMAN_EXECUTION_EXPORT template struct sender_adaptor_closure : ::beman::execution::detail::pipeable::sender_adaptor_closure_base {}; // NOLINTEND(bugprone-crtp-constructor-accessibility) @@ -30,7 +31,7 @@ concept is_sender_adaptor_closure = } namespace beman::execution::detail::pipeable { -template <::beman::execution::sender Sender, typename Adaptor> +BEMAN_EXECUTION_EXPORT template <::beman::execution::sender Sender, typename Adaptor> requires(!::beman::execution::sender) && ::std::derived_from<::std::decay_t, ::beman::execution::sender_adaptor_closure<::std::decay_t>> && @@ -44,4 +45,4 @@ auto operator|(Sender&& sender, Adaptor&& adaptor) { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER_ADAPTOR_CLOSURE diff --git a/include/beman/execution/detail/sender_awaitable.hpp b/include/beman/execution/detail/sender_awaitable.hpp index 4f72cb5e..d6157d72 100644 --- a/include/beman/execution/detail/sender_awaitable.hpp +++ b/include/beman/execution/detail/sender_awaitable.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER_AWAITABLE #define INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER_AWAITABLE +#include #include #include #include @@ -110,4 +111,4 @@ class sender_awaitable { }; } // namespace beman::execution::detail -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER_AWAITABLE diff --git a/include/beman/execution/detail/sender_decompose.hpp b/include/beman/execution/detail/sender_decompose.hpp index 0b8ab53d..29777788 100644 --- a/include/beman/execution/detail/sender_decompose.hpp +++ b/include/beman/execution/detail/sender_decompose.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER_DECOMPOSE #define INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER_DECOMPOSE +#include #include #include #include @@ -84,4 +85,4 @@ auto get_sender_meta(Sender&& sender) { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER_DECOMPOSE diff --git a/include/beman/execution/detail/sender_for.hpp b/include/beman/execution/detail/sender_for.hpp index f95aefd0..2b0d2160 100644 --- a/include/beman/execution/detail/sender_for.hpp +++ b/include/beman/execution/detail/sender_for.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER_FOR #define INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER_FOR +#include #include #include #include @@ -18,4 +19,4 @@ concept sender_for = ::beman::execution::sender && ::std::same_as<::bema // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER_FOR diff --git a/include/beman/execution/detail/sender_has_affine_on.hpp b/include/beman/execution/detail/sender_has_affine_on.hpp index 742fb026..6a433afa 100644 --- a/include/beman/execution/detail/sender_has_affine_on.hpp +++ b/include/beman/execution/detail/sender_has_affine_on.hpp @@ -1,9 +1,10 @@ // include/beman/execution/detail/sender_has_affine_on.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_SENDER_HAS_AFFINE_ON -#define INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_SENDER_HAS_AFFINE_ON +#ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER_HAS_AFFINE_ON +#define INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER_HAS_AFFINE_ON +#include #include #include #include @@ -21,4 +22,4 @@ concept sender_has_affine_on = // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER_HAS_AFFINE_ON diff --git a/include/beman/execution/detail/sender_in.hpp b/include/beman/execution/detail/sender_in.hpp index 8b247051..b2f2957f 100644 --- a/include/beman/execution/detail/sender_in.hpp +++ b/include/beman/execution/detail/sender_in.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER_IN #define INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER_IN +#include #include #include #include @@ -13,7 +14,7 @@ // ---------------------------------------------------------------------------- namespace beman::execution { -template > +BEMAN_EXECUTION_EXPORT template > concept sender_in = ::beman::execution::sender && ::beman::execution::detail::queryable && requires(Sender&& sender, Env&& env) { @@ -25,4 +26,4 @@ concept sender_in = // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SENDER_IN diff --git a/include/beman/execution/detail/sends_stopped.hpp b/include/beman/execution/detail/sends_stopped.hpp index 54e22c44..56a0bf82 100644 --- a/include/beman/execution/detail/sends_stopped.hpp +++ b/include/beman/execution/detail/sends_stopped.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SENDS_STOPPED #define INCLUDED_BEMAN_EXECUTION_DETAIL_SENDS_STOPPED +#include #include #include #include @@ -15,7 +16,7 @@ // ---------------------------------------------------------------------------- namespace beman::execution { -template > +BEMAN_EXECUTION_EXPORT template > requires ::beman::execution::sender_in inline constexpr bool sends_stopped{!::std::same_as< ::beman::execution::detail::type_list<>, @@ -27,4 +28,4 @@ inline constexpr bool sends_stopped{!::std::same_as< // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SENDS_STOPPED diff --git a/include/beman/execution/detail/set_error.hpp b/include/beman/execution/detail/set_error.hpp index e30e9548..bd00fc45 100644 --- a/include/beman/execution/detail/set_error.hpp +++ b/include/beman/execution/detail/set_error.hpp @@ -16,7 +16,7 @@ namespace beman::execution { * \brief Type of the customization point object for error completions. * \headerfile beman/execution/execution.hpp */ -struct set_error_t { +BEMAN_EXECUTION_EXPORT struct set_error_t { template auto operator()(Receiver&, Error&&) const -> void = BEMAN_EXECUTION_DELETE("set_error requires the receiver to be passed as non-const rvalue"); @@ -46,11 +46,11 @@ struct set_error_t { * \brief Customization point object for error completions. * \headerfile beman/execution/execution.hpp */ -inline constexpr set_error_t set_error{}; +BEMAN_EXECUTION_EXPORT inline constexpr set_error_t set_error{}; } // namespace beman::execution // ---------------------------------------------------------------------------- #include -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SET_ERROR diff --git a/include/beman/execution/detail/set_stopped.hpp b/include/beman/execution/detail/set_stopped.hpp index 52902bf0..43a68d33 100644 --- a/include/beman/execution/detail/set_stopped.hpp +++ b/include/beman/execution/detail/set_stopped.hpp @@ -16,7 +16,7 @@ namespace beman::execution { * \brief Type of the customization point object for cancellation completions. * \headerfile beman/execution/execution.hpp */ -struct set_stopped_t { +BEMAN_EXECUTION_EXPORT struct set_stopped_t { template auto operator()(Receiver&) const -> void = BEMAN_EXECUTION_DELETE("set_stopped requires the receiver to be passed as non-const rvalue"); @@ -42,11 +42,11 @@ struct set_stopped_t { * \brief Customization point object for cancellation completions. * \headerfile beman/execution/execution.hpp */ -inline constexpr set_stopped_t set_stopped{}; +BEMAN_EXECUTION_EXPORT inline constexpr set_stopped_t set_stopped{}; } // namespace beman::execution // ---------------------------------------------------------------------------- #include -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SET_STOPPED diff --git a/include/beman/execution/detail/set_value.hpp b/include/beman/execution/detail/set_value.hpp index ec01849f..30dd8bbf 100644 --- a/include/beman/execution/detail/set_value.hpp +++ b/include/beman/execution/detail/set_value.hpp @@ -16,7 +16,7 @@ namespace beman::execution { * \brief Type of the customization point object for successful completions. * \headerfile beman/execution/execution.hpp */ -struct set_value_t { +BEMAN_EXECUTION_EXPORT struct set_value_t { template auto operator()(Receiver&, Args&&...) const -> void = BEMAN_EXECUTION_DELETE("set_value requires the receiver to be passed as non-const rvalue"); @@ -44,11 +44,11 @@ struct set_value_t { * \brief Customization point object for successful completions. * \headerfile beman/execution/execution.hpp */ -inline constexpr set_value_t set_value{}; +BEMAN_EXECUTION_EXPORT inline constexpr set_value_t set_value{}; } // namespace beman::execution // ---------------------------------------------------------------------------- #include -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SET_VALUE diff --git a/include/beman/execution/detail/simple_allocator.hpp b/include/beman/execution/detail/simple_allocator.hpp index d65ea482..90bde1c0 100644 --- a/include/beman/execution/detail/simple_allocator.hpp +++ b/include/beman/execution/detail/simple_allocator.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SIMPLE_ALLOCATOR #define INCLUDED_BEMAN_EXECUTION_DETAIL_SIMPLE_ALLOCATOR +#include #include #include @@ -21,4 +22,4 @@ concept simple_allocator = // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SIMPLE_ALLOCATOR diff --git a/include/beman/execution/detail/simple_counting_scope.hpp b/include/beman/execution/detail/simple_counting_scope.hpp index 84b3c187..1a5d1269 100644 --- a/include/beman/execution/detail/simple_counting_scope.hpp +++ b/include/beman/execution/detail/simple_counting_scope.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SIMPLE_COUNTING_SCOPE #define INCLUDED_BEMAN_EXECUTION_DETAIL_SIMPLE_COUNTING_SCOPE +#include #include #include #include @@ -13,7 +14,7 @@ // ---------------------------------------------------------------------------- namespace beman::execution { -class simple_counting_scope; +BEMAN_EXECUTION_EXPORT class simple_counting_scope; } // ---------------------------------------------------------------------------- @@ -52,4 +53,4 @@ inline auto beman::execution::simple_counting_scope::get_token() noexcept // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SIMPLE_COUNTING_SCOPE diff --git a/include/beman/execution/detail/single_sender.hpp b/include/beman/execution/detail/single_sender.hpp index 2912e386..a27e97cc 100644 --- a/include/beman/execution/detail/single_sender.hpp +++ b/include/beman/execution/detail/single_sender.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SINGLE_SENDER #define INCLUDED_BEMAN_EXECUTION_DETAIL_SINGLE_SENDER +#include #include #include @@ -17,4 +18,4 @@ concept single_sender = ::beman::execution::sender_in && // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SINGLE_SENDER diff --git a/include/beman/execution/detail/single_sender_value_type.hpp b/include/beman/execution/detail/single_sender_value_type.hpp index 4bbffa41..b5e6e9fa 100644 --- a/include/beman/execution/detail/single_sender_value_type.hpp +++ b/include/beman/execution/detail/single_sender_value_type.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SINGLE_SENDER_VALUE_TYPE #define INCLUDED_BEMAN_EXECUTION_DETAIL_SINGLE_SENDER_VALUE_TYPE +#include #include #include #include @@ -55,4 +56,4 @@ using single_sender_value_type = typename single_sender_value_type_helper #include #include #include @@ -84,10 +85,10 @@ struct spawn_t { } // namespace beman::execution::detail namespace beman::execution { -using spawn_t = ::beman::execution::detail::spawn_t; -inline constexpr spawn_t spawn{}; +BEMAN_EXECUTION_EXPORT using spawn_t = ::beman::execution::detail::spawn_t; +BEMAN_EXECUTION_EXPORT inline constexpr spawn_t spawn{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SPAWN diff --git a/include/beman/execution/detail/spawn_future.hpp b/include/beman/execution/detail/spawn_future.hpp index 7f80ab12..86f36ce8 100644 --- a/include/beman/execution/detail/spawn_future.hpp +++ b/include/beman/execution/detail/spawn_future.hpp @@ -1,9 +1,10 @@ // include/beman/execution/detail/spawn_future.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_SPAWN_FUTURE -#define INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_SPAWN_FUTURE +#ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SPAWN_FUTURE +#define INCLUDED_BEMAN_EXECUTION_DETAIL_SPAWN_FUTURE +#include #include #include #include @@ -219,9 +220,8 @@ class spawn_future_t { template <::beman::execution::sender Sndr, ::beman::execution::scope_token Tok, typename Ev> requires ::beman::execution::detail::queryable<::std::remove_cvref_t> auto operator()(Sndr&& sndr, Tok&& tok, Ev&& ev) const { - auto make{[&]() -> decltype(auto) { //-dk:TODO why decltype(auto) instead of auto? - return tok.wrap(::std::forward(sndr)); - }}; + //-dk:TODO why decltype(auto) instead of auto? + auto make{[&]() -> decltype(auto) { return tok.wrap(::std::forward(sndr)); }}; using sndr_t = decltype(make()); static_assert(::beman::execution::sender); @@ -262,10 +262,10 @@ struct impls_for : ::beman::execution::detail::default_impls { } // namespace beman::execution::detail namespace beman::execution { -using spawn_future_t = ::beman::execution::detail::spawn_future_t; -inline constexpr spawn_future_t spawn_future{}; +BEMAN_EXECUTION_EXPORT using spawn_future_t = ::beman::execution::detail::spawn_future_t; +BEMAN_EXECUTION_EXPORT inline constexpr spawn_future_t spawn_future{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SPAWN_FUTURE diff --git a/include/beman/execution/detail/spawn_get_allocator.hpp b/include/beman/execution/detail/spawn_get_allocator.hpp index 1056a513..86d55271 100644 --- a/include/beman/execution/detail/spawn_get_allocator.hpp +++ b/include/beman/execution/detail/spawn_get_allocator.hpp @@ -1,9 +1,10 @@ // include/beman/execution/detail/spawn_get_allocator.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_SPAWN_GET_ALLOCATOR -#define INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_SPAWN_GET_ALLOCATOR +#ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SPAWN_GET_ALLOCATOR +#define INCLUDED_BEMAN_EXECUTION_DETAIL_SPAWN_GET_ALLOCATOR +#include #include #include #include @@ -33,4 +34,4 @@ auto spawn_get_allocator(const Sndr& sndr, const Ev& ev) { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SPAWN_GET_ALLOCATOR diff --git a/include/beman/execution/detail/split.hpp b/include/beman/execution/detail/split.hpp index cf2c55c2..150f1880 100644 --- a/include/beman/execution/detail/split.hpp +++ b/include/beman/execution/detail/split.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SPLIT #define INCLUDED_BEMAN_EXECUTION_DETAIL_SPLIT +#include #include #include #include @@ -32,6 +33,7 @@ #include #include #include +#include // ---------------------------------------------------------------------------- @@ -379,9 +381,9 @@ struct completion_signatures_for_impl< } // namespace beman::execution::detail namespace beman::execution { -using split_t = ::beman::execution::detail::split_t; +BEMAN_EXECUTION_EXPORT using split_t = ::beman::execution::detail::split_t; -inline constexpr ::beman::execution::split_t split{}; +BEMAN_EXECUTION_EXPORT inline constexpr ::beman::execution::split_t split{}; } // namespace beman::execution -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SPLIT diff --git a/include/beman/execution/detail/start.hpp b/include/beman/execution/detail/start.hpp index 0a542d53..9e62737a 100644 --- a/include/beman/execution/detail/start.hpp +++ b/include/beman/execution/detail/start.hpp @@ -11,7 +11,7 @@ // ---------------------------------------------------------------------------- namespace beman::execution { -struct start_t { +BEMAN_EXECUTION_EXPORT struct start_t { template auto operator()(State&&) const -> void = BEMAN_EXECUTION_DELETE("start(obj) requires an lvalue argument"); template @@ -44,11 +44,11 @@ struct start_t { // NOLINTEND(misc-no-recursion) }; -inline constexpr start_t start{}; +BEMAN_EXECUTION_EXPORT inline constexpr start_t start{}; } // namespace beman::execution // ---------------------------------------------------------------------------- #include -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_START diff --git a/include/beman/execution/detail/starts_on.hpp b/include/beman/execution/detail/starts_on.hpp index 3685d294..1a09d71a 100644 --- a/include/beman/execution/detail/starts_on.hpp +++ b/include/beman/execution/detail/starts_on.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_STARTS_ON #define INCLUDED_BEMAN_EXECUTION_DETAIL_STARTS_ON +#include #include #include #include @@ -53,10 +54,10 @@ struct starts_on_t { } // namespace beman::execution::detail namespace beman::execution { -using ::beman::execution::detail::starts_on_t; -inline constexpr ::beman::execution::detail::starts_on_t starts_on{}; +BEMAN_EXECUTION_EXPORT using starts_on_t = ::beman::execution::detail::starts_on_t; +BEMAN_EXECUTION_EXPORT inline constexpr ::beman::execution::detail::starts_on_t starts_on{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_STARTS_ON diff --git a/include/beman/execution/detail/state_type.hpp b/include/beman/execution/detail/state_type.hpp index c90a96c8..d7cedde8 100644 --- a/include/beman/execution/detail/state_type.hpp +++ b/include/beman/execution/detail/state_type.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_STATE_TYPE #define INCLUDED_BEMAN_EXECUTION_DETAIL_STATE_TYPE +#include #include #include #include @@ -14,12 +15,12 @@ namespace beman::execution::detail { template -using state_type = ::std::decay_t< ::beman::execution::detail::call_result_t< - decltype(::beman::execution::detail::impls_for< ::beman::execution::tag_of_t >::get_state), +using state_type = ::std::decay_t<::beman::execution::detail::call_result_t< + decltype(::beman::execution::detail::impls_for<::beman::execution::tag_of_t>::get_state), Sender, - Receiver&> >; + Receiver&>>; } // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_STATE_TYPE diff --git a/include/beman/execution/detail/stop_callback_for_t.hpp b/include/beman/execution/detail/stop_callback_for_t.hpp index 6177c49b..9b658149 100644 --- a/include/beman/execution/detail/stop_callback_for_t.hpp +++ b/include/beman/execution/detail/stop_callback_for_t.hpp @@ -4,12 +4,13 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_STOP_CALLBACK_FOR #define INCLUDED_BEMAN_EXECUTION_DETAIL_STOP_CALLBACK_FOR +#include #include // ---------------------------------------------------------------------------- namespace beman::execution { -template +BEMAN_EXECUTION_EXPORT template using stop_callback_for_t = typename Token::template callback_type; } @@ -25,4 +26,4 @@ concept stoppable_callback_for = // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_STOP_CALLBACK_FOR diff --git a/include/beman/execution/detail/stop_source.hpp b/include/beman/execution/detail/stop_source.hpp index 083211db..d24752a6 100644 --- a/include/beman/execution/detail/stop_source.hpp +++ b/include/beman/execution/detail/stop_source.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_STOP_SOURCE #define INCLUDED_BEMAN_EXECUTION_DETAIL_STOP_SOURCE +#include #include #include #include @@ -15,11 +16,11 @@ // ---------------------------------------------------------------------------- namespace beman::execution { -class stop_token; -class stop_source; -template +BEMAN_EXECUTION_EXPORT class stop_token; +BEMAN_EXECUTION_EXPORT class stop_source; +BEMAN_EXECUTION_EXPORT template class stop_callback; -template +BEMAN_EXECUTION_EXPORT template stop_callback(::beman::execution::stop_token, CallbackFun) -> stop_callback; } // namespace beman::execution @@ -255,4 +256,4 @@ inline auto beman::execution::stop_source::request_stop() noexcept -> bool { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_STOP_SOURCE diff --git a/include/beman/execution/detail/stop_token_of_t.hpp b/include/beman/execution/detail/stop_token_of_t.hpp index 73ee2892..cb2ea4e5 100644 --- a/include/beman/execution/detail/stop_token_of_t.hpp +++ b/include/beman/execution/detail/stop_token_of_t.hpp @@ -4,16 +4,17 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_STOP_TOKEN_OF #define INCLUDED_BEMAN_EXECUTION_DETAIL_STOP_TOKEN_OF +#include #include #include // ---------------------------------------------------------------------------- namespace beman::execution { -template +BEMAN_EXECUTION_EXPORT template using stop_token_of_t = ::std::remove_cvref_t()))>; } // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_STOP_TOKEN_OF diff --git a/include/beman/execution/detail/stop_when.hpp b/include/beman/execution/detail/stop_when.hpp index f989ec32..c6a1fee5 100644 --- a/include/beman/execution/detail/stop_when.hpp +++ b/include/beman/execution/detail/stop_when.hpp @@ -1,9 +1,10 @@ // include/beman/execution/detail/stop_when.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_STOP_WHEN -#define INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_STOP_WHEN +#ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_STOP_WHEN +#define INCLUDED_BEMAN_EXECUTION_DETAIL_STOP_WHEN +#include #include #include #include @@ -132,4 +133,4 @@ inline auto beman::execution::detail::stop_when_t::operator()(Sndr&& sndr, Tok&& // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_STOP_WHEN diff --git a/include/beman/execution/detail/stoppable_source.hpp b/include/beman/execution/detail/stoppable_source.hpp index 792dd4a6..570d80e0 100644 --- a/include/beman/execution/detail/stoppable_source.hpp +++ b/include/beman/execution/detail/stoppable_source.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_STOPPABLE_SOURCE #define INCLUDED_BEMAN_EXECUTION_DETAIL_STOPPABLE_SOURCE +#include #include #include @@ -21,4 +22,4 @@ concept stoppable_source = requires(Source& source, const Source& csource) { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_STOPPABLE_SOURCE diff --git a/include/beman/execution/detail/stoppable_token.hpp b/include/beman/execution/detail/stoppable_token.hpp index 14aa405c..ac2f0add 100644 --- a/include/beman/execution/detail/stoppable_token.hpp +++ b/include/beman/execution/detail/stoppable_token.hpp @@ -4,13 +4,14 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_STOPPABLE_TOKEN #define INCLUDED_BEMAN_EXECUTION_DETAIL_STOPPABLE_TOKEN +#include #include #include // ---------------------------------------------------------------------------- namespace beman::execution { -template +BEMAN_EXECUTION_EXPORT template concept stoppable_token = requires(const Token& token) { typename ::beman::execution::detail::check_type_alias_exist; { token.stop_requested() } noexcept -> ::std::same_as; @@ -21,4 +22,4 @@ concept stoppable_token = requires(const Token& token) { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_STOPPABLE_TOKEN diff --git a/include/beman/execution/detail/suppress_pop.hpp b/include/beman/execution/detail/suppress_pop.hpp index 6eefbb73..2a30cd98 100644 --- a/include/beman/execution/detail/suppress_pop.hpp +++ b/include/beman/execution/detail/suppress_pop.hpp @@ -6,9 +6,9 @@ #ifdef BEMAN_EXECUTION_DIAGNOSTIC_PUSHED #if defined(__GNUC__) #pragma GCC diagnostic pop -#endif +#endif // #if defined(__GNUC__) #if defined(__clang__) #pragma clang diagnostic pop -#endif +#endif // #if defined(__clang__) #undef BEMAN_EXECUTION_DIAGNOSTIC_PUSHED -#endif +#endif // #ifdef BEMAN_EXECUTION_DIAGNOSTIC_PUSHED diff --git a/include/beman/execution/detail/suppress_push.hpp b/include/beman/execution/detail/suppress_push.hpp index c4a51c25..579dbd35 100644 --- a/include/beman/execution/detail/suppress_push.hpp +++ b/include/beman/execution/detail/suppress_push.hpp @@ -8,7 +8,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmissing-braces" #pragma GCC diagnostic ignored "-Wmissing-field-initializers" -#endif +#endif // #if defined(__GNUC__) #if defined(__clang__) #define BEMAN_EXECUTION_DIAGNOSTIC_PUSHED @@ -16,4 +16,4 @@ #pragma clang diagnostic ignored "-Wunknown-warning-option" #pragma clang diagnostic ignored "-Wmissing-braces" #pragma clang diagnostic ignored "-Wc++26-extensions" -#endif +#endif // #if defined(__clang__) diff --git a/include/beman/execution/detail/suspend_complete.hpp b/include/beman/execution/detail/suspend_complete.hpp index a3c3d4b6..924da3dc 100644 --- a/include/beman/execution/detail/suspend_complete.hpp +++ b/include/beman/execution/detail/suspend_complete.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SUSPEND_COMPLETE #define INCLUDED_BEMAN_EXECUTION_DETAIL_SUSPEND_COMPLETE +#include #include #include #include @@ -31,4 +32,4 @@ auto suspend_complete(Fun fun, Args&&... args) noexcept { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SUSPEND_COMPLETE diff --git a/include/beman/execution/detail/sync_wait.hpp b/include/beman/execution/detail/sync_wait.hpp index 6d38b213..1c4bde65 100644 --- a/include/beman/execution/detail/sync_wait.hpp +++ b/include/beman/execution/detail/sync_wait.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_SYNC_WAIT #define INCLUDED_BEMAN_EXECUTION_DETAIL_SYNC_WAIT +#include #include #include #include @@ -107,7 +108,7 @@ struct sync_wait_t { } // namespace beman::execution::detail namespace beman::execution { -using sync_wait_t = ::beman::execution::detail::sync_wait_t; +BEMAN_EXECUTION_EXPORT using sync_wait_t = ::beman::execution::detail::sync_wait_t; /*! * \brief sync_wait(_sender_) starts _sender_ and waits for its completion. * \headerfile beman/execution/execution.hpp @@ -155,9 +156,9 @@ using sync_wait_t = ::beman::execution::detail::sync_wait_t; * } * */ -inline constexpr ::beman::execution::sync_wait_t sync_wait{}; +BEMAN_EXECUTION_EXPORT inline constexpr ::beman::execution::sync_wait_t sync_wait{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_SYNC_WAIT diff --git a/include/beman/execution/detail/tag_of_t.hpp b/include/beman/execution/detail/tag_of_t.hpp index 85ebc773..7a83c2fb 100644 --- a/include/beman/execution/detail/tag_of_t.hpp +++ b/include/beman/execution/detail/tag_of_t.hpp @@ -4,16 +4,17 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_TAG_OF #define INCLUDED_BEMAN_EXECUTION_DETAIL_TAG_OF +#include #include #include // ---------------------------------------------------------------------------- namespace beman::execution { -template +BEMAN_EXECUTION_EXPORT template using tag_of_t = typename decltype(::beman::execution::detail::get_sender_meta(::std::declval()))::tag_type; } // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_TAG_OF diff --git a/include/beman/execution/detail/then.hpp b/include/beman/execution/detail/then.hpp index 56078d0a..c393b0fc 100644 --- a/include/beman/execution/detail/then.hpp +++ b/include/beman/execution/detail/then.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_THEN #define INCLUDED_BEMAN_EXECUTION_DETAIL_THEN +#include #include #include #include @@ -149,17 +150,17 @@ namespace beman::execution { * \brief then_t is the type of then. * \headerfile beman/execution/execution.hpp */ -using then_t = ::beman::execution::detail::then_t<::beman::execution::set_value_t>; +BEMAN_EXECUTION_EXPORT using then_t = ::beman::execution::detail::then_t<::beman::execution::set_value_t>; /*! * \brief upon_error_t is the type of upon_error. * \headerfile beman/execution/execution.hpp */ -using upon_error_t = ::beman::execution::detail::then_t<::beman::execution::set_error_t>; +BEMAN_EXECUTION_EXPORT using upon_error_t = ::beman::execution::detail::then_t<::beman::execution::set_error_t>; /*! * \brief upon_stopped_t is the type of upon_stopped. * \headerfile beman/execution/execution.hpp */ -using upon_stopped_t = ::beman::execution::detail::then_t<::beman::execution::set_stopped_t>; +BEMAN_EXECUTION_EXPORT using upon_stopped_t = ::beman::execution::detail::then_t<::beman::execution::set_stopped_t>; /*! * \brief then(_sender_, _fun_) yields a sender transforming a set_value_t(_A_...) completion @@ -211,7 +212,7 @@ using upon_stopped_t = ::beman::execution::detail::then_t<::beman::execution::se * } * */ -inline constexpr ::beman::execution::then_t then{}; +BEMAN_EXECUTION_EXPORT inline constexpr ::beman::execution::then_t then{}; /*! * \brief upon_error(_sender_, _fun_) yields a sender transforming a set_error_t(_E_) @@ -265,7 +266,7 @@ inline constexpr ::beman::execution::then_t then{}; * } * */ -inline constexpr ::beman::execution::upon_error_t upon_error{}; +BEMAN_EXECUTION_EXPORT inline constexpr ::beman::execution::upon_error_t upon_error{}; /*! * \brief upon_stopped(_sender_, _fun_) yields a sender transforming a set_stopped_t() @@ -316,9 +317,9 @@ inline constexpr ::beman::execution::upon_error_t upon_error{}; * } * */ -inline constexpr ::beman::execution::upon_stopped_t upon_stopped{}; +BEMAN_EXECUTION_EXPORT inline constexpr ::beman::execution::upon_stopped_t upon_stopped{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_THEN diff --git a/include/beman/execution/detail/transform_sender.hpp b/include/beman/execution/detail/transform_sender.hpp index d87f477b..10ec17d4 100644 --- a/include/beman/execution/detail/transform_sender.hpp +++ b/include/beman/execution/detail/transform_sender.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_TRANSFORM_SENDER #define INCLUDED_BEMAN_EXECUTION_DETAIL_TRANSFORM_SENDER +#include #include #include #include @@ -65,7 +66,7 @@ constexpr auto transform_sender(Domain dom, Sender&& sender, const Env&... env) } // namespace beman::execution::detail namespace beman::execution { -template +BEMAN_EXECUTION_EXPORT template requires(sizeof...(Env) < 2) && requires(Domain dom, Sender&& sender, const Env&... env) { dom.transform_sender(::std::forward(sender), env...); @@ -78,7 +79,7 @@ constexpr auto transform_sender(Domain, Sender&& sender, const Env&...) noexcept return ::std::forward(sender); } -template +BEMAN_EXECUTION_EXPORT template requires(sizeof...(Env) < 2) && requires(Domain dom, Sender&& sender, const Env&... env) { dom.transform_sender(::std::forward(sender), env...); @@ -92,7 +93,7 @@ constexpr auto transform_sender(Domain dom, Sender&& sender, const Env&... env) dom, dom.transform_sender(::std::forward(sender), env...), env...); } -template +BEMAN_EXECUTION_EXPORT template requires(sizeof...(Env) < 2) && (not requires(Domain dom, Sender&& sender, const Env&... env) { dom.transform_sender(::std::forward(sender), env...); }) && @@ -105,7 +106,7 @@ constexpr auto return ::std::forward(sender); } -template +BEMAN_EXECUTION_EXPORT template requires(sizeof...(Env) < 2) && (not requires(Domain dom, Sender&& sender, const Env&... env) { dom.transform_sender(::std::forward(sender), env...); }) && @@ -124,4 +125,4 @@ constexpr auto transform_sender(Domain dom, Sender&& sender, const Env&... env) // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_TRANSFORM_SENDER diff --git a/include/beman/execution/detail/type_list.hpp b/include/beman/execution/detail/type_list.hpp index 787a6e17..5089fbca 100644 --- a/include/beman/execution/detail/type_list.hpp +++ b/include/beman/execution/detail/type_list.hpp @@ -4,6 +4,8 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_TYPE_LIST #define INCLUDED_BEMAN_EXECUTION_DETAIL_TYPE_LIST +#include + // ---------------------------------------------------------------------------- namespace beman::execution::detail { @@ -13,4 +15,4 @@ struct type_list {}; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_TYPE_LIST diff --git a/include/beman/execution/detail/unspecified_promise.hpp b/include/beman/execution/detail/unspecified_promise.hpp index f8acbb89..da59efcb 100644 --- a/include/beman/execution/detail/unspecified_promise.hpp +++ b/include/beman/execution/detail/unspecified_promise.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_UNSPECIFIED_PROMISE #define INCLUDED_BEMAN_EXECUTION_DETAIL_UNSPECIFIED_PROMISE +#include #include namespace beman::execution::detail { @@ -17,4 +18,4 @@ struct unspecified_promise { }; } // namespace beman::execution::detail -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_UNSPECIFIED_PROMISE diff --git a/include/beman/execution/detail/unstoppable_token.hpp b/include/beman/execution/detail/unstoppable_token.hpp index f63c0a59..b1d4bc97 100644 --- a/include/beman/execution/detail/unstoppable_token.hpp +++ b/include/beman/execution/detail/unstoppable_token.hpp @@ -4,17 +4,18 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_UNSTOPPABLE_TOKEN #define INCLUDED_BEMAN_EXECUTION_DETAIL_UNSTOPPABLE_TOKEN +#include #include #include // ---------------------------------------------------------------------------- namespace beman::execution { -template +BEMAN_EXECUTION_EXPORT template concept unstoppable_token = ::beman::execution::stoppable_token && requires() { requires ::std::bool_constant::value; }; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_UNSTOPPABLE_TOKEN diff --git a/include/beman/execution/detail/valid_completion_for.hpp b/include/beman/execution/detail/valid_completion_for.hpp index 64e1acfd..51aae9e1 100644 --- a/include/beman/execution/detail/valid_completion_for.hpp +++ b/include/beman/execution/detail/valid_completion_for.hpp @@ -4,7 +4,8 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_VALID_COMPLETION_FOR #define INCLUDED_BEMAN_EXECUTION_DETAIL_VALID_COMPLETION_FOR -#include +#include +#include #include #include #include @@ -38,4 +39,4 @@ concept valid_completion_for = requires(Signature* signature) { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_VALID_COMPLETION_FOR diff --git a/include/beman/execution/detail/valid_completion_signatures.hpp b/include/beman/execution/detail/valid_completion_signatures.hpp index 0599d19d..d25ca709 100644 --- a/include/beman/execution/detail/valid_completion_signatures.hpp +++ b/include/beman/execution/detail/valid_completion_signatures.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_VALID_COMPLETION_SIGNATURES #define INCLUDED_BEMAN_EXECUTION_DETAIL_VALID_COMPLETION_SIGNATURES +#include #include #include @@ -21,4 +22,4 @@ concept valid_completion_signatures = valid_completion_signatures_helper + // ---------------------------------------------------------------------------- namespace beman::execution::detail { @@ -13,4 +15,4 @@ concept valid_specialization = requires { typename T; }; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_VALID_SPECIALIZATION diff --git a/include/beman/execution/detail/value_types_of_t.hpp b/include/beman/execution/detail/value_types_of_t.hpp index 87274572..1c279184 100644 --- a/include/beman/execution/detail/value_types_of_t.hpp +++ b/include/beman/execution/detail/value_types_of_t.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_VALUE_TYPE_OF #define INCLUDED_BEMAN_EXECUTION_DETAIL_VALUE_TYPE_OF +#include #include #include #include @@ -14,17 +15,17 @@ // ---------------------------------------------------------------------------- namespace beman::execution { -template , - template class Tuple = ::beman::execution::detail::decayed_tuple, - template class Variant = ::beman::execution::detail::variant_or_empty> +BEMAN_EXECUTION_EXPORT template , + template class Tuple = ::beman::execution::detail::decayed_tuple, + template class Variant = ::beman::execution::detail::variant_or_empty> requires ::beman::execution::sender_in using value_types_of_t = - ::beman::execution::detail::gather_signatures< ::beman::execution::set_value_t, - ::beman::execution::completion_signatures_of_t, - Tuple, - Variant>; + ::beman::execution::detail::gather_signatures<::beman::execution::set_value_t, + ::beman::execution::completion_signatures_of_t, + Tuple, + Variant>; } // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_VALUE_TYPE_OF diff --git a/include/beman/execution/detail/variant_or_empty.hpp b/include/beman/execution/detail/variant_or_empty.hpp index 52257741..a89b3422 100644 --- a/include/beman/execution/detail/variant_or_empty.hpp +++ b/include/beman/execution/detail/variant_or_empty.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_VARIANT_OR_EMPTY #define INCLUDED_BEMAN_EXECUTION_DETAIL_VARIANT_OR_EMPTY +#include #include #include #include @@ -34,4 +35,4 @@ using variant_or_empty = typename ::beman::execution::detail::variant_or_empty_h // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_VARIANT_OR_EMPTY diff --git a/include/beman/execution/detail/when_all.hpp b/include/beman/execution/detail/when_all.hpp index daa373d2..031bd7d0 100644 --- a/include/beman/execution/detail/when_all.hpp +++ b/include/beman/execution/detail/when_all.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_WHEN_ALL #define INCLUDED_BEMAN_EXECUTION_DETAIL_WHEN_ALL +#include #include #include #include @@ -167,7 +168,7 @@ struct impls_for<::beman::execution::detail::when_all_t> : ::beman::execution::d } Receiver* receiver{}; - ::std::atomic count{sizeof...(Sender)}; + ::std::atomic<::std::size_t> count{sizeof...(Sender)}; ::beman::execution::inplace_stop_source stop_src{}; ::std::atomic disp{disposition::started}; errors_variant errors{}; @@ -260,10 +261,10 @@ struct completion_signatures_for_impl< } // namespace beman::execution::detail namespace beman::execution { -using ::beman::execution::detail::when_all_t; -inline constexpr ::beman::execution::when_all_t when_all{}; +BEMAN_EXECUTION_EXPORT using when_all_t = ::beman::execution::detail::when_all_t; +BEMAN_EXECUTION_EXPORT inline constexpr ::beman::execution::when_all_t when_all{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_WHEN_ALL diff --git a/include/beman/execution/detail/when_all_with_variant.hpp b/include/beman/execution/detail/when_all_with_variant.hpp index c1beba20..5a37adc9 100644 --- a/include/beman/execution/detail/when_all_with_variant.hpp +++ b/include/beman/execution/detail/when_all_with_variant.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_WHEN_ALL_WITH_VARIANT #define INCLUDED_BEMAN_EXECUTION_DETAIL_WHEN_ALL_WITH_VARIANT +#include #include #include #include @@ -40,10 +41,10 @@ struct when_all_with_variant_t { } // namespace beman::execution::detail namespace beman::execution { -using ::beman::execution::detail::when_all_with_variant_t; -inline constexpr ::beman::execution::when_all_with_variant_t when_all_with_variant{}; +BEMAN_EXECUTION_EXPORT using when_all_with_variant_t = ::beman::execution::detail::when_all_with_variant_t; +BEMAN_EXECUTION_EXPORT inline constexpr ::beman::execution::when_all_with_variant_t when_all_with_variant{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_WHEN_ALL_WITH_VARIANT diff --git a/include/beman/execution/detail/with_await_transform.hpp b/include/beman/execution/detail/with_await_transform.hpp index adf06047..598ffe2a 100644 --- a/include/beman/execution/detail/with_await_transform.hpp +++ b/include/beman/execution/detail/with_await_transform.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_WITH_AWAIT_TRANSFORM #define INCLUDED_BEMAN_EXECUTION_DETAIL_WITH_AWAIT_TRANSFORM +#include #include #include #include @@ -30,4 +31,4 @@ struct with_await_transform { // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_WITH_AWAIT_TRANSFORM diff --git a/include/beman/execution/detail/with_awaitable_senders.hpp b/include/beman/execution/detail/with_awaitable_senders.hpp index 59371814..a744a3dc 100644 --- a/include/beman/execution/detail/with_awaitable_senders.hpp +++ b/include/beman/execution/detail/with_awaitable_senders.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_WITH_AWAITABLE_SENDERS #define INCLUDED_BEMAN_EXECUTION_DETAIL_WITH_AWAITABLE_SENDERS +#include #include #include #include @@ -11,7 +12,7 @@ #include namespace beman::execution { -template <::beman::execution::detail::class_type Promise> +BEMAN_EXECUTION_EXPORT template <::beman::execution::detail::class_type Promise> struct with_awaitable_senders { template requires(!::std::same_as) @@ -50,4 +51,4 @@ struct with_awaitable_senders { } // namespace beman::execution -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_WITH_AWAITABLE_SENDERS diff --git a/include/beman/execution/detail/write_env.hpp b/include/beman/execution/detail/write_env.hpp index 6fff51b3..1cfc3e60 100644 --- a/include/beman/execution/detail/write_env.hpp +++ b/include/beman/execution/detail/write_env.hpp @@ -4,6 +4,7 @@ #ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_WRITE_ENV #define INCLUDED_BEMAN_EXECUTION_DETAIL_WRITE_ENV +#include #include #include #include @@ -52,10 +53,10 @@ inline constexpr write_env_t write_env{}; } // namespace beman::execution::detail namespace beman::execution { -using write_env_t = ::beman::execution::detail::write_env_t; -inline constexpr write_env_t write_env{}; +BEMAN_EXECUTION_EXPORT using write_env_t = ::beman::execution::detail::write_env_t; +BEMAN_EXECUTION_EXPORT inline constexpr write_env_t write_env{}; } // namespace beman::execution // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_WRITE_ENV diff --git a/include/beman/execution/execution.hpp b/include/beman/execution/execution.hpp index b68c68c7..ff2610a9 100644 --- a/include/beman/execution/execution.hpp +++ b/include/beman/execution/execution.hpp @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -65,4 +66,4 @@ // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_EXECUTION diff --git a/include/beman/execution/functional.hpp b/include/beman/execution/functional.hpp index dacf10a1..bc1a2f00 100644 --- a/include/beman/execution/functional.hpp +++ b/include/beman/execution/functional.hpp @@ -13,4 +13,4 @@ // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_FUNCTIONAL diff --git a/include/beman/execution/stop_token.hpp b/include/beman/execution/stop_token.hpp index 2638ac45..d4901ddb 100644 --- a/include/beman/execution/stop_token.hpp +++ b/include/beman/execution/stop_token.hpp @@ -16,4 +16,4 @@ // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION_STOP_TOKEN diff --git a/include/beman/execution26/execution.hpp b/include/beman/execution26/execution.hpp index b6d84148..d35d1dc1 100644 --- a/include/beman/execution26/execution.hpp +++ b/include/beman/execution26/execution.hpp @@ -1,8 +1,8 @@ // include/beman/execution26/execution.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION26_EXECUTION -#define INCLUDED_INCLUDE_BEMAN_EXECUTION26_EXECUTION +#ifndef INCLUDED_BEMAN_EXECUTION26_EXECUTION +#define INCLUDED_BEMAN_EXECUTION26_EXECUTION #include @@ -114,4 +114,4 @@ using ::beman::execution::with_awaitable_senders; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION26_EXECUTION diff --git a/include/beman/execution26/stop_token.hpp b/include/beman/execution26/stop_token.hpp index 07605ea1..dcd6a7ea 100644 --- a/include/beman/execution26/stop_token.hpp +++ b/include/beman/execution26/stop_token.hpp @@ -1,8 +1,8 @@ // include/beman/execution26/stop_token.hpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION26_STOP_TOKEN -#define INCLUDED_INCLUDE_BEMAN_EXECUTION26_STOP_TOKEN +#ifndef INCLUDED_BEMAN_EXECUTION26_STOP_TOKEN +#define INCLUDED_BEMAN_EXECUTION26_STOP_TOKEN #include @@ -25,4 +25,4 @@ using ::beman::execution::unstoppable_token; // ---------------------------------------------------------------------------- -#endif +#endif // INCLUDED_BEMAN_EXECUTION26_STOP_TOKEN diff --git a/src/beman/execution/CMakeLists.txt b/src/beman/execution/CMakeLists.txt index 0a3e3e34..10774bac 100644 --- a/src/beman/execution/CMakeLists.txt +++ b/src/beman/execution/CMakeLists.txt @@ -3,16 +3,13 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # gersemi: on -if(NOT TARGET ${TARGET_NAME}) - add_library(${TARGET_NAME} STATIC) -endif() -add_library(${TARGET_ALIAS} ALIAS ${TARGET_NAME}) +add_library(${TARGET_NAME} INTERFACE) +add_library(beman::execution_headers ALIAS ${TARGET_NAME}) target_sources( ${TARGET_NAME} - PRIVATE execution.cpp PUBLIC - FILE_SET ${TARGET_NAME}_public_headers + FILE_SET public_headers TYPE HEADERS BASE_DIRS ${PROJECT_SOURCE_DIR}/include FILES @@ -21,11 +18,11 @@ target_sources( ${PROJECT_SOURCE_DIR}/include/beman/execution/stop_token.hpp ${PROJECT_SOURCE_DIR}/include/beman/execution26/execution.hpp ${PROJECT_SOURCE_DIR}/include/beman/execution26/stop_token.hpp - PUBLIC - FILE_SET ${TARGET_NAME}_detail_headers - TYPE HEADERS - BASE_DIRS ${PROJECT_SOURCE_DIR}/include - FILES + # PUBLIC + # FILE_SET detail_headers + # TYPE HEADERS + # BASE_DIRS ${PROJECT_SOURCE_DIR}/include + # FILES ${PROJECT_SOURCE_DIR}/include/beman/execution/detail/affine_on.hpp ${PROJECT_SOURCE_DIR}/include/beman/execution/detail/allocator_aware_move.hpp ${PROJECT_SOURCE_DIR}/include/beman/execution/detail/almost_scheduler.hpp @@ -198,44 +195,22 @@ target_sources( if(BEMAN_USE_MODULES) target_sources( - ${TARGET_NAME} + ${TARGET_PREFIX} + PRIVATE + execution.cpp # TODO(CK): check if really needed! PUBLIC FILE_SET CXX_MODULES BASE_DIRS ${PROJECT_SOURCE_DIR}/src/beman/execution FILES ${PROJECT_SOURCE_DIR}/src/beman/execution/execution.cppm ) + target_link_libraries(${TARGET_PREFIX} PUBLIC ${TARGET_NAME}) endif() -get_property( - DETAIL_HEADER_FILES - TARGET ${TARGET_NAME} - PROPERTY HEADER_SET_${TARGET_NAME}_detail_headers -) -source_group("Header Files\\detail" FILES ${DETAIL_HEADER_FILES}) +# get_property( +# DETAIL_HEADER_FILES +# TARGET ${TARGET_NAME} +# PROPERTY HEADER_SET_detail_headers +# ) +# source_group("Header Files\\detail" FILES ${DETAIL_HEADER_FILES}) set_target_properties(${TARGET_NAME} PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON) - -if(NOT BEMAN_EXECUTION_ENABLE_INSTALL OR CMAKE_SKIP_INSTALL_RULES) - return() -endif() - -install( - TARGETS ${TARGET_NAME} - EXPORT ${TARGETS_EXPORT_NAME}1 - ARCHIVE DESTINATION lib/$ - FILE_SET ${TARGET_NAME}_public_headers - FILE_SET ${TARGET_NAME}_detail_headers - FILE_SET CXX_MODULES DESTINATION ${INSTALL_CONFIGDIR}/module - # There's currently no convention for this location - CXX_MODULES_BMI - DESTINATION ${INSTALL_CONFIGDIR}/bmi-${CMAKE_CXX_COMPILER_ID}_$ -) - -install( - EXPORT ${TARGETS_EXPORT_NAME}1 - FILE ${TARGETS_EXPORT_NAME}.cmake - DESTINATION "${INSTALL_CONFIGDIR}" - NAMESPACE ${TARGET_NAMESPACE}:: - CXX_MODULES_DIRECTORY - . -) diff --git a/src/beman/execution/execution.cppm b/src/beman/execution/execution.cppm index b8c57614..5827331d 100644 --- a/src/beman/execution/execution.cppm +++ b/src/beman/execution/execution.cppm @@ -1,222 +1,6478 @@ -// src/beman/execution/execution.cpp -*-C++-*- +module; // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// ---------------------------------------------------------------------------- +// *****************************************************; +// *** WARNING: this file is generated: do not edit! ***; +// *****************************************************; +// generated by ./bin/mk-module.py src/beman/execution/execution.cppm -module; -#include -#include -#include -#include +#include +#include + +#ifdef BEMAN_HAS_IMPORT_STD +import std; +#else +#line 240 "./bin/mk-module.py" +#include +#line 240 "./bin/mk-module.py" +#include +#line 240 "./bin/mk-module.py" +#include +#line 240 "./bin/mk-module.py" +#include +#line 240 "./bin/mk-module.py" +#include +#line 240 "./bin/mk-module.py" +#include +#line 240 "./bin/mk-module.py" +#include +#line 240 "./bin/mk-module.py" +#include +#line 240 "./bin/mk-module.py" +#include +#line 240 "./bin/mk-module.py" +#include +#line 240 "./bin/mk-module.py" +#include +#line 240 "./bin/mk-module.py" +#include +#line 240 "./bin/mk-module.py" +#include +#line 240 "./bin/mk-module.py" +#include +#line 240 "./bin/mk-module.py" +#include +#line 240 "./bin/mk-module.py" +#include +#line 240 "./bin/mk-module.py" +#include +#line 240 "./bin/mk-module.py" +#include +#line 240 "./bin/mk-module.py" +#include +#endif + +export module beman.execution; + +#line 5 "include/beman/execution/execution.hpp" + +#line 9 "include/beman/execution/detail/common.hpp" +#ifndef BEMAN_EXECUTION_EXPORT +#define BEMAN_EXECUTION_EXPORT +#endif + +#if defined(disabled__cpp_deleted_function) +#define BEMAN_EXECUTION_DELETE(msg) delete (msg) +#else +#define BEMAN_EXECUTION_DELETE(msg) delete +#endif + +#line 43 "include/beman/execution/detail/common.hpp" +namespace beman { + +#line 54 "include/beman/execution/detail/common.hpp" +namespace execution { + +#line 61 "include/beman/execution/detail/common.hpp" +namespace detail {} +} // namespace execution +} // namespace beman + +#line 6 "include/beman/execution/detail/suppress_push.hpp" +#if defined(__GNUC__) +#define BEMAN_EXECUTION_DIAGNOSTIC_PUSHED +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmissing-braces" +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif + +#if defined(__clang__) +#define BEMAN_EXECUTION_DIAGNOSTIC_PUSHED +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunknown-warning-option" +#pragma clang diagnostic ignored "-Wmissing-braces" +#pragma clang diagnostic ignored "-Wc++26-extensions" +#endif +#line 3 "include/beman/execution/detail/suppress_pop.hpp" + +#line 6 "include/beman/execution/detail/suppress_pop.hpp" +#ifdef BEMAN_EXECUTION_DIAGNOSTIC_PUSHED +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif +#if defined(__clang__) +#pragma clang diagnostic pop +#endif +#undef BEMAN_EXECUTION_DIAGNOSTIC_PUSHED +#endif +#line 3 "include/beman/execution/detail/queryable.hpp" + +#line 12 "include/beman/execution/detail/queryable.hpp" +namespace beman::execution::detail { +template +concept queryable = ::std::destructible; +} +#line 14 "include/beman/execution/detail/forwarding_query.hpp" +namespace beman::execution::detail { + +#line 20 "include/beman/execution/detail/forwarding_query.hpp" +struct forwarding_query_t { + template + requires requires(Object&& object, const forwarding_query_t& query) { + { ::std::forward(object).query(query) } noexcept -> ::std::same_as; + } + constexpr auto operator()(Object&& object) const noexcept -> bool { + return ::std::forward(object).query(*this); + } + template + constexpr auto operator()(Object&&) const noexcept -> bool { + return ::std::derived_from<::std::remove_cvref_t, ::beman::execution::detail::forwarding_query_t>; + } +}; +} // namespace beman::execution::detail + +namespace beman::execution { + +#line 40 "include/beman/execution/detail/forwarding_query.hpp" +export /* --------- */ using forwarding_query_t = beman::execution::detail::forwarding_query_t; + +#line 53 "include/beman/execution/detail/forwarding_query.hpp" +export /* --------- */ inline constexpr forwarding_query_t forwarding_query{}; +} // namespace beman::execution + +#line 13 "include/beman/execution/detail/movable_value.hpp" +namespace beman::execution::detail { +template +concept movable_value = + ::std::move_constructible<::std::decay_t> && ::std::constructible_from<::std::decay_t, T> && + (!::std::is_array_v<::std::remove_reference_t>); +} +#line 12 "include/beman/execution/detail/matching_sig.hpp" +namespace beman::execution::detail { +template +struct matching_sig_transform { + using type = Fun; +}; +template +struct matching_sig_transform { + using type = Return(Args&&...); +}; + +template +inline constexpr bool matching_sig = + ::std::same_as::type, + typename ::beman::execution::detail::matching_sig_transform::type>; +} // namespace beman::execution::detail + +#line 17 "include/beman/execution/detail/as_except_ptr.hpp" +namespace beman::execution::detail { + +#line 23 "include/beman/execution/detail/as_except_ptr.hpp" +template +decltype(auto) as_except_ptr(Error&& error) { + if constexpr (::std::same_as<::std::exception_ptr, ::std::decay_t>) { + return ::std::forward(error); + } else if constexpr (::std::same_as<::std::error_code, ::std::decay_t>) { + return ::std::make_exception_ptr(::std::system_error(error)); + } else { + return ::std::make_exception_ptr(::std::forward(error)); + } +} +} // namespace beman::execution::detail + +#line 14 "include/beman/execution/detail/set_value.hpp" +namespace beman::execution { + +#line 19 "include/beman/execution/detail/set_value.hpp" +export /* --------- */ struct set_value_t { + template + auto operator()(Receiver&, Args&&...) const + -> void = BEMAN_EXECUTION_DELETE("set_value requires the receiver to be passed as non-const rvalue"); + template + auto operator()(const Receiver&&, Args&&...) const + -> void = BEMAN_EXECUTION_DELETE("set_value requires the receiver to be passed as non-const rvalue"); + template + auto operator()(Receiver&&, Args&&...) const -> void + requires(not requires(Receiver&& receiver, Args&&... args) { + ::std::forward(receiver).set_value(::std::forward(args)...); + }) + = BEMAN_EXECUTION_DELETE("set_value requires a suitable member overload on the receiver"); + template + requires(not noexcept(::std::declval().set_value(::std::declval()...))) + auto operator()(Receiver&&, Args&&...) const + -> void = BEMAN_EXECUTION_DELETE("the call to receiver.set_value(args...) has to be noexcept"); + + template + auto operator()(Receiver&& receiver, Args&&... args) const noexcept -> void { + ::std::forward(receiver).set_value(::std::forward(args)...); + } +}; + +#line 47 "include/beman/execution/detail/set_value.hpp" +export /* --------- */ inline constexpr set_value_t set_value{}; +} // namespace beman::execution + +#line 14 "include/beman/execution/detail/set_error.hpp" +namespace beman::execution { + +#line 19 "include/beman/execution/detail/set_error.hpp" +export /* --------- */ struct set_error_t { + template + auto operator()(Receiver&, Error&&) const + -> void = BEMAN_EXECUTION_DELETE("set_error requires the receiver to be passed as non-const rvalue"); + template + auto operator()(const Receiver&&, Error&&) const + -> void = BEMAN_EXECUTION_DELETE("set_error requires the receiver to be passed as non-const rvalue"); + template + auto operator()(Receiver&&, Error&&) const -> void + requires(not requires(Receiver&& receiver, Error&& error) { + ::std::forward(receiver).set_error(::std::forward(error)); + }) + = BEMAN_EXECUTION_DELETE("set_error requires a suitable member overload on the receiver"); + template + requires(not noexcept(::std::declval().set_error(::std::declval()))) + auto operator()(Receiver&&, Error&&) const + -> void = BEMAN_EXECUTION_DELETE("the call to receiver.set_error(error) has to be noexcept"); + + // NOLINTBEGIN(misc-no-recursion) + template + auto operator()(Receiver&& receiver, Error&& error) const noexcept -> void { + ::std::forward(receiver).set_error(::std::forward(error)); + } + // NOLINTEND(misc-no-recursion) +}; + +#line 49 "include/beman/execution/detail/set_error.hpp" +export /* --------- */ inline constexpr set_error_t set_error{}; +} // namespace beman::execution + +#line 14 "include/beman/execution/detail/set_stopped.hpp" +namespace beman::execution { + +#line 19 "include/beman/execution/detail/set_stopped.hpp" +export /* --------- */ struct set_stopped_t { + template + auto operator()(Receiver&) const + -> void = BEMAN_EXECUTION_DELETE("set_stopped requires the receiver to be passed as non-const rvalue"); + template + auto operator()(const Receiver&&) const + -> void = BEMAN_EXECUTION_DELETE("set_stopped requires the receiver to be passed as non-const rvalue"); + template + auto operator()(Receiver&&) const -> void + requires(not requires(Receiver&& receiver) { ::std::forward(receiver).set_stopped(); }) + = BEMAN_EXECUTION_DELETE("set_stopped requires a suitable member overload on the receiver"); + template + requires(not noexcept(::std::declval().set_stopped())) + auto operator()(Receiver&&) const + -> void = BEMAN_EXECUTION_DELETE("the call to receiver.set_stopped() has to be noexcept"); + + template + auto operator()(Receiver&& receiver) const noexcept -> void { + ::std::forward(receiver).set_stopped(); + } +}; + +#line 45 "include/beman/execution/detail/set_stopped.hpp" +export /* --------- */ inline constexpr set_stopped_t set_stopped{}; +} // namespace beman::execution + +#line 13 "include/beman/execution/detail/start.hpp" +namespace beman::execution { +export /* --------- */ struct start_t { + template + auto operator()(State&&) const -> void = BEMAN_EXECUTION_DELETE("start(obj) requires an lvalue argument"); + template + requires(not requires(State& state) { state.start(); }) + auto operator()(State&) const -> void = BEMAN_EXECUTION_DELETE("state needs to have a start() member"); + template + requires(not requires(const State& state) { state.start(); }) + auto operator()(const State&) const -> void = BEMAN_EXECUTION_DELETE("state needs to have a start() member"); + + template + requires(not requires(State& state) { + { state.start() } noexcept; + }) + auto operator()(State&) const -> void = BEMAN_EXECUTION_DELETE("state start() member has to be noexcept"); + template + requires(not requires(const State& state) { + { state.start() } noexcept; + }) + auto operator()(const State&) const -> void = BEMAN_EXECUTION_DELETE("state start() member has to be noexcept"); + + template + auto operator()(const State& state) const noexcept -> void { + state.start(); + } + // NOLINTBEGIN(misc-no-recursion) + template + auto operator()(State& state) const noexcept -> void { + state.start(); + } + // NOLINTEND(misc-no-recursion) +}; + +export /* --------- */ inline constexpr start_t start{}; +} // namespace beman::execution + +#line 11 "include/beman/execution/detail/non_assignable.hpp" +namespace beman::execution::detail { +struct non_assignable; +} +#line 17 "include/beman/execution/detail/non_assignable.hpp" +struct beman::execution::detail::non_assignable { + non_assignable() = default; + non_assignable(non_assignable&&) = default; + non_assignable(const non_assignable&) = default; + auto operator=(non_assignable&&) -> non_assignable& = delete; + auto operator=(const non_assignable&) -> non_assignable& = delete; +}; + +#line 13 "include/beman/execution/detail/simple_allocator.hpp" +namespace beman::execution::detail { +template +concept simple_allocator = + requires(::std::remove_cvref_t alloc, ::std::size_t n) { + { *alloc.allocate(n) } -> ::std::same_as::value_type&>; + alloc.deallocate(alloc.allocate(n), n); + } && ::std::copy_constructible<::std::remove_cvref_t> && + ::std::equality_comparable<::std::remove_cvref_t>; +} // namespace beman::execution::detail + +#line 11 "include/beman/execution/detail/never_stop_token.hpp" +namespace beman::execution { +export /* --------- */ class never_stop_token; +} +#line 17 "include/beman/execution/detail/never_stop_token.hpp" +class beman::execution::never_stop_token { + struct private_callback_type { + explicit private_callback_type(never_stop_token, auto&&) noexcept {} + }; + + public: + template + using callback_type = private_callback_type; + + static constexpr auto stop_requested() noexcept -> bool { return {}; } + static constexpr auto stop_possible() noexcept -> bool { return {}; } + auto operator==(const never_stop_token&) const -> bool = default; +}; + +#line 12 "include/beman/execution/detail/decayed_same_as.hpp" +namespace beman::execution::detail { + +#line 19 "include/beman/execution/detail/decayed_same_as.hpp" +template +concept decayed_same_as = ::std::same_as<::std::remove_cvref_t, ::std::remove_cvref_t>; +} // namespace beman::execution::detail -export module beman_execution; +#line 12 "include/beman/execution/detail/callable.hpp" +namespace beman::execution::detail { +#line 19 "include/beman/execution/detail/callable.hpp" +template +concept callable = requires(Fun&& fun, Args&&... args) { ::std::forward(fun)(::std::forward(args)...); }; +} // namespace beman::execution::detail + +#line 15 "include/beman/execution/detail/forward_like.hpp" +namespace beman::execution::detail { +template +struct forward_like_helper; + +template +struct forward_like_helper { + template + static auto forward(U&& u) -> ::std::remove_reference_t&& { + return ::std::move(u); // NOLINT(bugprone-move-forwarding-reference) + } +}; +template +struct forward_like_helper { + template + static auto forward(U&& u) -> ::std::remove_cvref_t&& { + return ::std::move(u); // NOLINT(bugprone-move-forwarding-reference) + } +}; +template +struct forward_like_helper { + template + static auto forward(U&& u) -> ::std::remove_cvref_t& { + return ::std::forward(u); + } +}; +template +struct forward_like_helper { + template + static auto forward(U&& u) -> const ::std::remove_cvref_t&& { + return ::std::move(u); // NOLINT(bugprone-move-forwarding-reference) + } +}; +template +struct forward_like_helper { + template + static auto forward(U&& u) -> const ::std::remove_cvref_t& { + return ::std::forward(u); + } +}; + +#line 57 "include/beman/execution/detail/forward_like.hpp" +template +auto own_forward_like(U&& u) noexcept -> decltype(auto) { + return ::beman::execution::detail::forward_like_helper::forward(::std::forward(u)); +} +#line 67 "include/beman/execution/detail/forward_like.hpp" +template +auto forward_like(U&& u) noexcept -> decltype(auto) { +#if 202207 <= disabled__cpp_lib_forward_like + return ::std::forward_like(::std::forward(u)); +#else + return ::beman::execution::detail::forward_like_helper::forward(::std::forward(u)); +#endif +} +#line 76 "include/beman/execution/detail/forward_like.hpp" +} // namespace beman::execution::detail + +#line 13 "include/beman/execution/detail/join_env.hpp" +namespace beman::execution::detail { +template +class join_env { + private: + Env1 env1; + Env2 env2; + + public: + template + join_env(E1&& e1, E2&& e2) : env1(::std::forward(e1)), env2(::std::forward(e2)) {} + + template + requires( + requires(Env1&, const Query& query, Args&&... args) { + env1.query(query, ::std::forward(args)...); + } || + requires(Env2& e2, const Query& query, Args&&... args) { e2.query(query, ::std::forward(args)...); }) + auto query(const Query& query, Args&&... args) noexcept -> decltype(auto) { + if constexpr (requires { env1.query(query, ::std::forward(args)...); }) { + return env1.query(query, ::std::forward(args)...); + } else { + return env2.query(query, ::std::forward(args)...); + } + } + template + requires( + requires(const Env1&, const Query& query, Args&&... args) { + env1.query(query, ::std::forward(args)...); + } || + requires(const Env2& e2, const Query& query, Args&&... args) { + e2.query(query, ::std::forward(args)...); + }) + auto query(const Query& query, Args&&... args) const noexcept -> decltype(auto) { + if constexpr (requires { env1.query(query, ::std::forward(args)...); }) { + return env1.query(query, ::std::forward(args)...); + } else { + return env2.query(query, ::std::forward(args)...); + } + } +}; + +template +join_env(Env1&&, Env2&&) -> join_env<::std::remove_cvref_t, ::std::remove_cvref_t>; +} // namespace beman::execution::detail + +#line 15 "include/beman/execution/detail/product_type.hpp" +namespace beman::execution::detail { + +template <::std::size_t I, typename T> +struct product_type_element { + T value; + auto operator==(const product_type_element&) const -> bool = default; +}; + +template +struct product_type_base; + +template <::std::size_t... I, typename... T> +struct product_type_base<::std::index_sequence, T...> + : ::beman::execution::detail::product_type_element... { + static constexpr ::std::size_t size() { return sizeof...(T); } + static constexpr bool is_product_type{true}; + + template <::std::size_t J, typename S> + static auto element_get(::beman::execution::detail::product_type_element& self) noexcept -> S& { + return self.value; + } + template <::std::size_t J, typename S> + static auto element_get(::beman::execution::detail::product_type_element&& self) noexcept -> S&& { + return ::std::move(self.value); + } + template <::std::size_t J, typename S> + static auto element_get(const ::beman::execution::detail::product_type_element& self) noexcept -> const S& { + return self.value; + } +#line 45 "include/beman/execution/detail/product_type.hpp" + template <::std::size_t J> + auto get() & -> decltype(auto) { + return this->element_get(*this); + } + template <::std::size_t J> + auto get() && -> decltype(auto) { + return this->element_get(::std::move(*this)); + } + template <::std::size_t J> + auto get() const& -> decltype(auto) { + return this->element_get(*this); + } +#line 58 "include/beman/execution/detail/product_type.hpp" + template <::std::size_t J, typename Allocator, typename Self> + static auto make_element(Allocator&& alloc, Self&& self) -> decltype(auto) { + using type = ::std::remove_cvref_t(std::forward(self)))>; + if constexpr (::std::uses_allocator_v) + return ::std::make_obj_using_allocator(alloc, + product_type_base::element_get(std::forward(self))); + else + return product_type_base::element_get(std::forward(self)); + } +#line 68 "include/beman/execution/detail/product_type.hpp" + auto operator==(const product_type_base&) const -> bool = default; +}; + +template +concept is_product_type_c = requires(const T& t) { T::is_product_type; }; + +template +struct product_type : ::beman::execution::detail::product_type_base<::std::index_sequence_for, T...> { + template + static auto make_from(Allocator&& allocator, Product&& product, std::index_sequence) -> product_type { + return {product_type::template make_element(allocator, ::std::forward(product))...}; + } +#line 81 "include/beman/execution/detail/product_type.hpp" + template + static auto make_from(Allocator&& allocator, Product&& product) -> product_type { + return product_type::make_from( + ::std::forward(allocator), ::std::forward(product), ::std::index_sequence_for{}); + } +#line 87 "include/beman/execution/detail/product_type.hpp" + template + constexpr auto apply_elements(::std::index_sequence, Fun&& fun) const -> decltype(auto) { + return ::std::forward(fun)(this->template get()...); + } + template + constexpr auto apply(Fun&& fun) const -> decltype(auto) { + return apply_elements(::std::index_sequence_for{}, ::std::forward(fun)); + } + template + constexpr auto apply_elements(::std::index_sequence, Fun&& fun) -> decltype(auto) { + + return ::std::forward(fun)(std::move(this->template get())...); + } + template + constexpr auto apply(Fun&& fun) -> decltype(auto) { + return apply_elements(::std::index_sequence_for{}, ::std::forward(fun)); + } +}; +template +product_type(T&&...) -> product_type<::std::decay_t...>; + +template +constexpr auto is_product_type(const T&) -> ::std::false_type { + return {}; +} +template +constexpr auto is_product_type(const ::beman::execution::detail::product_type&) -> ::std::true_type { + return {}; +} +#line 117 "include/beman/execution/detail/product_type.hpp" +template <::std::size_t Start, typename Fun, typename Tuple, ::std::size_t... I> +constexpr auto sub_apply_helper(Fun&& fun, Tuple&& tuple, ::std::index_sequence) -> decltype(auto) { + // NOLINTNEXTLINE(bugprone-use-after-move,hicpp-invalid-access-moved) + return ::std::forward(fun)(::std::forward(tuple).template get()...); +} +#line 123 "include/beman/execution/detail/product_type.hpp" +template <::std::size_t Start, typename Fun, typename Tuple> +constexpr auto sub_apply(Fun&& fun, Tuple&& tuple) -> decltype(auto) { + constexpr ::std::size_t TSize{::std::tuple_size_v<::std::remove_cvref_t>}; + static_assert(Start <= TSize); + return sub_apply_helper( + ::std::forward(fun), ::std::forward(tuple), ::std::make_index_sequence()); +} +#line 131 "include/beman/execution/detail/product_type.hpp" +} // namespace beman::execution::detail + +namespace std { +template + requires ::beman::execution::detail::is_product_type_c +struct tuple_size : ::std::integral_constant {}; + +template <::std::size_t I, typename T> + requires ::beman::execution::detail::is_product_type_c +struct tuple_element { + using type = ::std::decay_t().template get())>; +}; +} // namespace std + +#line 12 "include/beman/execution/detail/query_with_default.hpp" +namespace beman::execution::detail { +template + requires requires(const Tag& tag, const Env& env) { tag(env); } +constexpr auto query_with_default(Tag, const Env& env, Value&&) noexcept(noexcept(Tag()(env))) -> decltype(auto) { + return Tag()(env); +} +#line 19 "include/beman/execution/detail/query_with_default.hpp" +template +constexpr auto +query_with_default(Tag, const Env&, Value&& value) noexcept(noexcept(static_cast(std::forward(value)))) + -> decltype(auto) { + return static_cast(std::forward(value)); +} +} // namespace beman::execution::detail + +#line 13 "include/beman/execution/detail/child_type.hpp" +namespace beman::execution::detail { + +#line 19 "include/beman/execution/detail/child_type.hpp" +template +using child_type = decltype(::std::declval().template get()); +} // namespace beman::execution::detail + +#line 13 "include/beman/execution/detail/decayed_tuple.hpp" +namespace beman::execution::detail { + +#line 19 "include/beman/execution/detail/decayed_tuple.hpp" +template +using decayed_tuple = ::std::tuple<::std::decay_t...>; +} // namespace beman::execution::detail + +#line 13 "include/beman/execution/detail/make_env.hpp" +namespace beman::execution::detail { +template +class make_env { + private: + Value value; + + public: + template + make_env(const Query&, V&& v) : value(::std::forward(v)) {} + constexpr auto query(const Query&) const noexcept -> const Value& { return this->value; } + constexpr auto query(const Query&) noexcept -> Value& { return this->value; } +}; +template +make_env(Query&&, Value&& value) -> make_env<::std::remove_cvref_t, ::std::remove_cvref_t>; +} // namespace beman::execution::detail + +#line 11 "include/beman/execution/detail/meta_prepend.hpp" +namespace beman::execution::detail::meta::detail { +template +struct prepend; + +template