]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Apply convertible_to concepts in parallel.h.
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 21 Mar 2023 17:48:49 +0000 (11:48 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 21 Mar 2023 17:48:49 +0000 (11:48 -0600)
include/deal.II/base/parallel.h

index b55a1b109a2f19c91177ac989bc56e6c43899950..106493dfe0b0713897f9f857257d2f247b62a9a0 100644 (file)
@@ -133,7 +133,10 @@ namespace parallel
    * module.
    */
   template <typename InputIterator, typename OutputIterator, typename Function>
-  DEAL_II_CXX20_REQUIRES((std::invocable<Function, InputIterator>))
+  DEAL_II_CXX20_REQUIRES(
+    (std::invocable<Function, InputIterator> &&
+     std::convertible_to<std::invoke_result_t<Function, InputIterator>,
+                         decltype(*std::declval<OutputIterator>())>))
   void transform(const InputIterator &begin_in,
                  const InputIterator &end_in,
                  OutputIterator       out,
@@ -193,7 +196,10 @@ namespace parallel
             typename OutputIterator,
             typename Function>
   DEAL_II_CXX20_REQUIRES(
-    (std::invocable<Function, InputIterator1, InputIterator2>))
+    (std::invocable<Function, InputIterator1, InputIterator2> &&
+     std::convertible_to<
+       std::invoke_result_t<Function, InputIterator1, InputIterator2>,
+       decltype(*std::declval<OutputIterator>())>))
   void transform(const InputIterator1 &begin_in1,
                  const InputIterator1 &end_in1,
                  InputIterator2        in2,
@@ -256,7 +262,12 @@ namespace parallel
             typename OutputIterator,
             typename Function>
   DEAL_II_CXX20_REQUIRES(
-    (std::invocable<Function, InputIterator1, InputIterator2, InputIterator3>))
+    (std::invocable<Function, InputIterator1, InputIterator2, InputIterator3> &&
+     std::convertible_to<std::invoke_result_t<Function,
+                                              InputIterator1,
+                                              InputIterator2,
+                                              InputIterator3>,
+                         decltype(*std::declval<OutputIterator>())>))
   void transform(const InputIterator1 &begin_in1,
                  const InputIterator1 &end_in1,
                  InputIterator2        in2,
@@ -528,7 +539,10 @@ namespace parallel
    * module.
    */
   template <typename ResultType, typename Iterator, typename Function>
-  DEAL_II_CXX20_REQUIRES((std::invocable<Function, Iterator, Iterator>))
+  DEAL_II_CXX20_REQUIRES(
+    (std::invocable<Function, Iterator, Iterator> &&
+     std::convertible_to<std::invoke_result_t<Function, Iterator, Iterator>,
+                         ResultType>))
   ResultType
     accumulate_from_subranges(const Function &                         f,
                               const Iterator &                         begin,

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.