proxygen
piping.h
Go to the documentation of this file.
1 /*
2  * Copyright 2018-present Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
19 
20 namespace folly {
21 namespace pushmi {
22 
23 PUSHMI_TEMPLATE(class In, class Op)
24 (requires lazy::Sender<std::decay_t<In>>&& lazy::Invocable<Op&, In>)
25 decltype(auto) operator|(In&& in, Op op) {
26  return op((In &&) in);
27 }
28 
29 PUSHMI_INLINE_VAR constexpr struct pipe_fn {
30 #if __cpp_fold_expressions >= 201603
31  template <class T, class... FN>
32  auto operator()(T t, FN... fn) const -> decltype((t | ... | fn)) {
33  return (t | ... | fn);
34  }
35 #else
36  template <class T, class F>
37  auto operator()(T t, F f) const -> decltype(t | f) {
38  return t | f;
39  }
40  template <class T, class F, class... FN, class This = pipe_fn>
41  auto operator()(T t, F f, FN... fn) const
42  -> decltype(This()((t | f), fn...)) {
43  return This()((t | f), fn...);
44  }
45 #endif
46 } const pipe{};
47 
48 } // namespace pushmi
49 } // namespace folly
requires lazy::Sender< std::decay_t< In > > &&decltype(auto) lazy::Invocable< Op &, In > operator|(In &&in, Op op)
Definition: piping.h:25
PUSHMI_INLINE_VAR constexpr struct folly::pushmi::pipe_fn pipe
auto f
requires Tuple && t
folly::std T
auto operator()(T t, F f) const -> decltype(t|f)
Definition: piping.h:37
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29
#define PUSHMI_INLINE_VAR
Definition: concept_def.h:60
requires requires(detail::apply_impl(std::declval< F >(), std::declval< Tuple >(), detail::tupidxs< Tuple >{}))) const expr decltype(auto) apply(F &&f
auto operator()(T t, F f, FN...fn) const -> decltype(This()((t|f), fn...))
Definition: piping.h:41
PUSHMI_TEMPLATE(class E=std::exception_ptr, class Wrapped)(requires Sender< detail
Definition: executor.h:102
const
Definition: upload.py:398