Sacado Package Browser (Single Doxygen Collection) Version of the Day
Loading...
Searching...
No Matches
Sacado_mpl_vector.hpp
Go to the documentation of this file.
1// @HEADER
2// ***********************************************************************
3//
4// Sacado Package
5// Copyright (2006) Sandia Corporation
6//
7// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8// the U.S. Government retains certain rights in this software.
9//
10// This library is free software; you can redistribute it and/or modify
11// it under the terms of the GNU Lesser General Public License as
12// published by the Free Software Foundation; either version 2.1 of the
13// License, or (at your option) any later version.
14//
15// This library is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18// Lesser General Public License for more details.
19//
20// You should have received a copy of the GNU Lesser General Public
21// License along with this library; if not, write to the Free Software
22// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23// USA
24// Questions? Contact David M. Gay (dmgay@sandia.gov) or Eric T. Phipps
25// (etphipp@sandia.gov).
26//
27// ***********************************************************************
28// @HEADER
29
30#ifndef SACADO_MPL_VECTOR_HPP
31#define SACADO_MPL_VECTOR_HPP
32
33#include "Sacado_ConfigDefs.h"
34
35#include "Sacado_mpl_none.hpp"
36#include "Sacado_mpl_size.hpp"
37#include "Sacado_mpl_begin.hpp"
38#include "Sacado_mpl_end.hpp"
39#include "Sacado_mpl_next.hpp"
41#include "Sacado_mpl_at.hpp"
42#include "Sacado_mpl_deref.hpp"
43
44// Specializations needed for various mpl operations
46
47namespace Sacado {
48
49 namespace mpl {
50
51 // vector tag for mpl operations
52 struct vector_tag {};
53
54 // vector
55 template <typename... Args>
56 struct vector :
57 vector_size<Args...> {
58 typedef vector_tag tag;
59 typedef vector type;
60 };
61
62 // iterator
63 template <class Vector, int Pos>
65 static const int value = Pos;
66 };
67
68 // size
69 template <>
71 template <class Vector>
72 struct apply {
73 static const int value = Vector::sz;
74 };
75 };
76
77 // begin
78 template <>
80 template <class Vector>
81 struct apply {
83 };
84 };
85
86 // end
87 template <>
89 template <class Vector>
93 };
94
95 // next
96 template <class Vector, int Pos>
97 struct next< vector_iterator<Vector,Pos> > {
99 };
100
101 // deref
102 template <class Vector, int Pos>
103 struct deref< vector_iterator<Vector,Pos> > : mpl::at<Vector,Pos> {};
104
105 }
106
107}
108
111
112namespace Sacado {
113 namespace mpl {
114
115 // at
116 template <int Pos>
117 struct at_impl<vector_tag, Pos> {
118 template <class Vector>
119 struct apply : vector_at<Vector,Pos> {};
120 };
121
122 // push_back
123 template <>
125 template <class Vector, class T>
126 struct apply : vector_push_back<Vector, T> {};
127 };
128
129 }
130}
131
132#endif
vector_iterator< Vector, Vector::sz > type