1 // The Art of C++ / Sequences
2 // Copyright (c) 2015 Daniel Frey
3 
4 #ifndef TAOCPP_SEQUENCES_INCLUDE_INCLUSIVE_SCAN_HPP
5 #define TAOCPP_SEQUENCES_INCLUDE_INCLUSIVE_SCAN_HPP
6 
7 #include <utility>
8 
9 #include "plus.hpp"
10 #include "exclusive_scan.hpp"
11 #include "integer_sequence.hpp"
12 
13 namespace tao
14 {
15   namespace seq
16   {
17     template< typename T, T... Ns >
18     struct inclusive_scan
19       : plus< exclusive_scan_t< T, Ns... >, integer_sequence< T, Ns... > >
20     {};
21 
22     template< typename T, T... Ns >
23     struct inclusive_scan< integer_sequence< T, Ns... > >
24       : plus< exclusive_scan_t< integer_sequence< T, Ns... > >, integer_sequence< T, Ns... > >
25     {};
26 
27     template< typename T, T... Ns >
28     using inclusive_scan_t = typename inclusive_scan< T, Ns... >::type;
29   }
30 }
31 
32 #endif // TAOCPP_SEQUENCES_INCLUDE_INCLUSIVE_SCAN_HPP
33