proxygen
for_each.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 
21 
22 namespace folly {
23 namespace pushmi {
24 
25 PUSHMI_INLINE_VAR constexpr struct for_each_fn {
26  private:
27  template <class Function>
28  struct fn {
30  template <class Cursor>
31  void operator()(detail::any, Cursor cursor) const {
32  f_(*cursor);
33  }
34  };
35  struct identity {
36  template <class T>
37  auto operator()(T&& t) const {
38  return (T &&) t;
39  }
40  };
41  struct zero {
43  return 0;
44  }
45  };
46 
47  public:
48  template <class ExecutionPolicy, class RandomAccessIterator, class Function>
49  void operator()(
50  ExecutionPolicy&& policy,
51  RandomAccessIterator begin,
52  RandomAccessIterator end,
53  Function f) const {
54  operators::just(0) |
56  fn<Function>{f}, begin, end, policy, identity{}, zero{}) |
58  }
59 } for_each{};
60 
61 } // namespace pushmi
62 } // namespace folly
auto f
PUSHMI_INLINE_VAR constexpr struct folly::pushmi::for_each_fn for_each
requires Tuple && t
auto begin(TestAdlIterable &instance)
Definition: ForeachTest.cpp:56
folly::std T
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29
auto operator()(T &&t) const
Definition: for_each.h:37
requires E e noexcept(noexcept(s.error(std::move(e))))
void operator()(detail::any, Cursor cursor) const
Definition: for_each.h:31
PUSHMI_INLINE_VAR constexpr detail::blocking_submit_fn blocking_submit
Definition: submit.h:389
void operator()(ExecutionPolicy &&policy, RandomAccessIterator begin, RandomAccessIterator end, Function f) const
Definition: for_each.h:49
auto end(TestAdlIterable &instance)
Definition: ForeachTest.cpp:62
#define PUSHMI_INLINE_VAR
Definition: concept_def.h:60
int operator()(detail::any) const noexcept
Definition: for_each.h:42
PUSHMI_INLINE_VAR constexpr struct folly::pushmi::operators::bulk_fn bulk
const
Definition: upload.py:398
PUSHMI_INLINE_VAR constexpr struct folly::pushmi::operators::just_fn just