loop2.hpp 1.26 KB
Newer Older
1
// Software License for MTL
2
//
3
4
5
6
7
// Copyright (c) 2007 The Trustees of Indiana University.
//               2008 Dresden University of Technology and the Trustees of Indiana University.
//               2010 SimuNova UG (haftungsbeschränkt), www.simunova.com.
// All rights reserved.
// Authors: Peter Gottschling and Andrew Lumsdaine
8
//
9
// This file is part of the Matrix Template Library
10
//
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// See also license.mtl.txt in the distribution.

#ifndef META_MATH_LOOP2_INCLUDE
#define META_MATH_LOOP2_INCLUDE

// See loop3.hpp for example

namespace meta_math {

template <std::size_t Index0, std::size_t Max0, std::size_t Index1, std::size_t Max1>
struct loop2
{
    static const std::size_t index0= Index0 - 1, next_index0= Index0,
            	             index1= Index1 - 1, next_index1= Index1 + 1;
};


template <std::size_t Index0, std::size_t Max0, std::size_t Max1>
struct loop2<Index0, Max0, Max1, Max1>
{
    static const std::size_t index0= Index0 - 1, next_index0= Index0 + 1,
            	             index1= Max1 - 1, next_index1= 1;
};


template <std::size_t Max0, std::size_t Max1>
struct loop2<Max0, Max0, Max1, Max1>
{
    static const std::size_t index0= Max0 - 1,
            	             index1= Max1 - 1;
};


} // namespace meta_math

#endif // META_MATH_LOOP2_INCLUDE