finitediff
SNvector.h
Go to the documentation of this file.
1 /*
2 Copyright 2017 Laurent Claessens
3 contact : laurent@claessens-donadello.eu
4 
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #ifndef __SNVECTOR_H__170345_
20 #define __SNVECTOR_H__170345_
21 
22 #include <array>
23 
24 /*
25 This is my vector type, designed for numerical computation.
26 */
27 
28 // THE CLASS HEADER -----------------------------------------
29 
30 template <class T,unsigned int tp_size>
31 class SNvector
32 {
33 
34  private:
35  std::array<T,tp_size> data;
36  public :
37  T get(unsigned int) const;
38  T& at(unsigned int);
39 };
40 
41 
42 template <class T,unsigned int tp_size>
43 T SNvector<T,tp_size>::get(unsigned int i) const
44 {
45  return data.at(i);
46 }
47 template <class T,unsigned int tp_size>
48 T& SNvector<T,tp_size>::at(unsigned int i)
49 {
50  return data.at(i);
51 }
52 
53 
54 #endif
T get(unsigned int) const
Definition: SNvector.h:43
std::array< T, tp_size > data
Definition: SNvector.h:35
Definition: SNvector.h:31
T & at(unsigned int)
Definition: SNvector.h:48