blob: 0afa367fdc46f5a12ac071dc7eaedeb762641e15 [file] [log] [blame]
Brian Silverman7c33ab22018-08-04 17:14:51 -07001/*
2 Copyright 2011 Mario Mulansky
3 Copyright 2012 Karsten Ahnert
4
5 Distributed under the Boost Software License, Version 1.0.
6 (See accompanying file LICENSE_1_0.txt or
7 copy at http://www.boost.org/LICENSE_1_0.txt)
8 */
9
10
11/* nested range algebra */
12
13#ifndef NESTED_RANGE_ALGEBRA
14#define NESTED_RANGE_ALGEBRA
15
16namespace detail {
17
18 template< class Iterator1 , class Iterator2 , class Iterator3 , class Operation , class Algebra >
19 void for_each3( Iterator1 first1 , Iterator1 last1 , Iterator2 first2 , Iterator3 first3, Operation op , Algebra &algebra )
20{
21 for( ; first1 != last1 ; )
22 algebra.for_each3( *first1++ , *first2++ , *first3++ , op );
23}
24}
25
26
27template< class InnerAlgebra >
28struct nested_range_algebra
29{
30
31 nested_range_algebra()
32 : m_inner_algebra()
33 { }
34
35 template< class S1 , class S2 , class S3 , class Op >
36 void for_each3( S1 &s1 , S2 &s2 , S3 &s3 , Op op )
37 {
38 detail::for_each3( boost::begin( s1 ) , boost::end( s1 ) , boost::begin( s2 ) , boost::begin( s3 ) , op , m_inner_algebra );
39 }
40
41
42private:
43 InnerAlgebra m_inner_algebra;
44};
45
46#endif