-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathArrayBaseN.h.m4
More file actions
87 lines (75 loc) · 2.68 KB
/
ArrayBaseN.h.m4
File metadata and controls
87 lines (75 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// -*- c++ -*-
/*
* Copyright (c) 2010-2012, Jim Bosch
* All rights reserved.
*
* ndarray is distributed under a simple BSD-like license;
* see the LICENSE file that should be present in the root
* of the source distribution, or alternately available at:
* https://github.com/ndarray/ndarray
*/
// THIS FILE IS MACHINE GENERATED BY SCONS. DO NOT EDIT MANUALLY.
changecom(`###')dnl
define(`SPECIALIZE',
`
/**
* @brief An intermediate CRTP base class for Array and ArrayRef (specialization for $1).
*/
template <typename Derived>
class ArrayBaseN<Derived,$1> : public ArrayBase< Derived > {
typedef ArrayBase<Derived> Super;
protected:
typedef typename Super::Core Core;
typedef typename Super::CorePtr CorePtr;
public:
typedef typename Super::Element Element;
Element & operator()($2) const {
return this->operator[](makeVector($3));
}
private:
template <typename T_, int N_, int C_> friend class Array;
template <typename T_, int N_, int C_> friend class ArrayRef;
void operator=(ArrayBaseN const & other) {
Super::operator=(other);
}
template <typename Other>
ArrayBaseN(ArrayBaseN<Other,$1> const & other) : Super(other) {}
ArrayBaseN(Element * data, CorePtr const & core) : Super(data, core) {}
};')dnl
#ifndef NDARRAY_ArrayBaseN_h_INCLUDED
#define NDARRAY_ArrayBaseN_h_INCLUDED
/**
* @file ndarray/ArrayBaseN.h
*
* @brief Definition of ArrayBaseN, a dimension-specialized CRTP base class for Array and ArrayRef.
*/
#include "ndarray/ArrayBase.h"
namespace ndarray {
/**
* @brief An intermediate CRTP base class for Array and ArrayRef.
*/
template <typename Derived, int N = ArrayBase<Derived>::ND::value>
class ArrayBaseN : public ArrayBase< Derived > {
typedef ArrayBase<Derived> Super;
protected:
typedef typename Super::Core Core;
typedef typename Super::CorePtr CorePtr;
public:
typedef typename Super::Element Element;
private:
template <typename T_, int N_, int C_> friend class Array;
template <typename T_, int N_, int C_> friend class ArrayRef;
void operator=(ArrayBaseN const & other) {
Super::operator=(other);
}
/// @internal @brief Construct an ArrayRef from a pointer and Core.
ArrayBaseN(Element * data, CorePtr const & core) : Super(data, core) {}
};
SPECIALIZE(1, `int n0', `n0')
SPECIALIZE(2, `int n0, int n1', `n0, n1')
SPECIALIZE(3, `int n0, int n1, int n2', `n0, n1, n2')
SPECIALIZE(4, `int n0, int n1, int n2, int n3', `n0, n1, n2, n3')
SPECIALIZE(5, `int n0, int n1, int n2, int n3, int n4', `n0, n1, n2, n3, n4')
SPECIALIZE(6, `int n0, int n1, int n2, int n3, int n4, int n5', `n0, n1, n2, n3, n4, n5')
} // namespace ndarray
#endif // !NDARRAY_ArrayBaseN_h_INCLUDED