GrPPI  1.0
Generic and Reusable Parallel Pattern Interface
stream_reduce.h
Go to the documentation of this file.
1 /*
2  * Copyright 2018 Universidad Carlos III de Madrid
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 #ifndef GRPPI_STREAM_REDUCE_H
17 #define GRPPI_STREAM_REDUCE_H
18 
19 #include "common/patterns.h"
20 
21 namespace grppi {
22 
43 template <typename Identity, typename Combiner>
44 auto reduce(int window_size, int offset,
45  Identity identity,
46  Combiner && combine_op)
47 {
48 // static_assert(std::is_same<Identity,typename std::result_of<Combiner(Identity,Identity)>::type>::value,
49 // "reduce combiner should be homogeneous:T = op(T,T)");
51  window_size, offset, identity,
52  std::forward<Combiner>(combine_op));
53 }
54 
60 }
61 
62 #endif
Representation of reduce pattern. Represents a reduction that can be used as a stage on a pipeline.
Definition: reduce_pattern.h:29
auto reduce(const Execution &ex, InputIt first, std::size_t size, Result &&identity, Combiner &&combine_op)
Invoke Reduce pattern with identity value on a data sequence with sequential execution.
Definition: reduce.h:50
Definition: callable_traits.h:21