SeqAn3
The Modern C++ library for sequence analysis.
execution_handler_sequential.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2019, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2019, Knut Reinert & MPI für molekulare Genetik
4 // This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5 // shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6 // -----------------------------------------------------------------------------------------------------
7 
13 #pragma once
14 
15 #include <functional>
16 
17 #include <seqan3/core/platform.hpp>
18 #include <seqan3/std/concepts>
19 #include <seqan3/std/ranges>
20 
21 namespace seqan3::detail
22 {
23 
27 struct execution_handler_sequential
28 {
29 public:
30 
45  template <typename fn_type, typename first_range_type, typename second_range_type, typename delegate_type>
48  std::Invocable<delegate_type, std::invoke_result_t<fn_type,
49  size_t const,
50  first_range_type,
51  second_range_type>>
53  void execute(fn_type && func,
54  size_t const idx,
55  first_range_type first_range,
56  second_range_type second_range,
57  delegate_type && delegate)
58  {
59  static_assert(std::ranges::View<first_range_type>, "Expected a view!");
60  static_assert(std::ranges::View<second_range_type>, "Expected a view!");
61 
62  delegate(func(idx, std::move(first_range), std::move(second_range)));
63  }
64 
66  void wait() noexcept
67  {
68  // noop
69  }
70 };
71 
72 } // namespace seqan3
Provides platform and dependency checks.
Specifies the requirements of a Range type that has constant time copy, move and assignment operators...
Specifies whether the given callable is invocable with the given arguments.
The Concepts library.
Adaptations of concepts from the Ranges TS.
Definition: aligned_sequence_concept.hpp:35