gslcpp
Modern-C++ Wrapper for GSL
get.hpp
Go to the documentation of this file.
1 /// \file include/gslcpp/wrap/get.hpp
2 /// \copyright 2022 Thomas E. Vaughan, all rights reserved.
3 /// \brief Definition of gsl::w_get().
4 
5 #pragma once
6 #include "container.hpp" // w_vector
7 
8 namespace gsl {
9 
10 
11 /// Return `i`th element of vector `v` with bounds-checking.
12 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_get
13 /// @param v Pointer to vector.
14 /// @param i Offset of element in vector.
15 /// @return Value of element or 0 on bounds-error.
16 inline auto w_get(w_vector<double const> *v, size_t i) {
17  return gsl_vector_get(v, i);
18 }
19 
20 
21 /// Return `i`th element of vector `v` with bounds-checking.
22 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_get
23 /// @param v Pointer to vector.
24 /// @param i Offset of element in vector.
25 /// @return Value of element or 0 on bounds-error.
26 inline auto w_get(w_vector<float const> *v, size_t i) {
27  return gsl_vector_float_get(v, i);
28 }
29 
30 
31 /// Return `i`th element of vector `v` with bounds-checking.
32 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_get
33 /// @param v Pointer to vector.
34 /// @param i Offset of element in vector.
35 /// @return Value of element or 0 on bounds-error.
36 inline auto w_get(w_vector<long double const> *v, size_t i) {
37  return gsl_vector_long_double_get(v, i);
38 }
39 
40 
41 /// Return `i`th element of vector `v` with bounds-checking.
42 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_get
43 /// @param v Pointer to vector.
44 /// @param i Offset of element in vector.
45 /// @return Value of element or 0 on bounds-error.
46 inline auto w_get(w_vector<int const> *v, size_t i) {
47  return gsl_vector_int_get(v, i);
48 }
49 
50 
51 /// Return `i`th element of vector `v` with bounds-checking.
52 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_get
53 /// @param v Pointer to vector.
54 /// @param i Offset of element in vector.
55 /// @return Value of element or 0 on bounds-error.
56 inline auto w_get(w_vector<unsigned const> *v, size_t i) {
57  return gsl_vector_uint_get(v, i);
58 }
59 
60 
61 /// Return `i`th element of vector `v` with bounds-checking.
62 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_get
63 /// @param v Pointer to vector.
64 /// @param i Offset of element in vector.
65 /// @return Value of element or 0 on bounds-error.
66 inline auto w_get(w_vector<long const> *v, size_t i) {
67  return gsl_vector_long_get(v, i);
68 }
69 
70 
71 /// Return `i`th element of vector `v` with bounds-checking.
72 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_get
73 /// @param v Pointer to vector.
74 /// @param i Offset of element in vector.
75 /// @return Value of element or 0 on bounds-error.
76 inline auto w_get(w_vector<unsigned long const> *v, size_t i) {
77  return gsl_vector_ulong_get(v, i);
78 }
79 
80 
81 /// Return `i`th element of vector `v` with bounds-checking.
82 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_get
83 /// @param v Pointer to vector.
84 /// @param i Offset of element in vector.
85 /// @return Value of element or 0 on bounds-error.
86 inline auto w_get(w_vector<short const> *v, size_t i) {
87  return gsl_vector_short_get(v, i);
88 }
89 
90 
91 /// Return `i`th element of vector `v` with bounds-checking.
92 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_get
93 /// @param v Pointer to vector.
94 /// @param i Offset of element in vector.
95 /// @return Value of element or 0 on bounds-error.
96 inline auto w_get(w_vector<unsigned short const> *v, size_t i) {
97  return gsl_vector_ushort_get(v, i);
98 }
99 
100 
101 /// Return `i`th element of vector `v` with bounds-checking.
102 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_get
103 /// @param v Pointer to vector.
104 /// @param i Offset of element in vector.
105 /// @return Value of element or 0 on bounds-error.
106 inline auto w_get(w_vector<char const> *v, size_t i) {
107  return gsl_vector_char_get(v, i);
108 }
109 
110 
111 /// Return `i`th element of vector `v` with bounds-checking.
112 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_get
113 /// @param v Pointer to vector.
114 /// @param i Offset of element in vector.
115 /// @return Value of element or 0 on bounds-error.
116 inline auto w_get(w_vector<unsigned char const> *v, size_t i) {
117  return gsl_vector_uchar_get(v, i);
118 }
119 
120 
121 /// Return `i`th element of vector `v` with bounds-checking.
122 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_get
123 /// @param v Pointer to vector.
124 /// @param i Offset of element in vector.
125 /// @return Value of element or 0 on bounds-error.
126 inline auto w_get(w_vector<complex<double> const> *v, size_t i) {
127  return gsl_vector_complex_get(v, i);
128 }
129 
130 
131 /// Return `i`th element of vector `v` with bounds-checking.
132 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_get
133 /// @param v Pointer to vector.
134 /// @param i Offset of element in vector.
135 /// @return Value of element or 0 on bounds-error.
136 inline auto w_get(w_vector<complex<float> const> *v, size_t i) {
137  return gsl_vector_complex_float_get(v, i);
138 }
139 
140 
141 /// Return `i`th element of vector `v` with bounds-checking.
142 /// https://www.gnu.org/software/gsl/doc/html/vectors.html#c.gsl_vector_get
143 /// @param v Pointer to vector.
144 /// @param i Offset of element in vector.
145 /// @return Value of element or 0 on bounds-error.
146 inline auto w_get(w_vector<complex<long double> const> *v, size_t i) {
147  return gsl_vector_complex_long_double_get(v, i);
148 }
149 
150 
151 } // namespace gsl
152 
153 // EOF
gsl::w_get
auto w_get(w_vector< complex< float > const > *v, size_t i)
Return ith element of vector v with bounds-checking.
Definition: get.hpp:136
gsl::w_get
auto w_get(w_vector< double const > *v, size_t i)
Return ith element of vector v with bounds-checking.
Definition: get.hpp:16
gsl::w_get
auto w_get(w_vector< int const > *v, size_t i)
Return ith element of vector v with bounds-checking.
Definition: get.hpp:46
gsl::w_get
auto w_get(w_vector< char const > *v, size_t i)
Return ith element of vector v with bounds-checking.
Definition: get.hpp:106
gsl::w_get
auto w_get(w_vector< float const > *v, size_t i)
Return ith element of vector v with bounds-checking.
Definition: get.hpp:26
gsl::w_get
auto w_get(w_vector< long const > *v, size_t i)
Return ith element of vector v with bounds-checking.
Definition: get.hpp:66
gsl::w_get
auto w_get(w_vector< unsigned long const > *v, size_t i)
Return ith element of vector v with bounds-checking.
Definition: get.hpp:76
gsl::w_get
auto w_get(w_vector< unsigned const > *v, size_t i)
Return ith element of vector v with bounds-checking.
Definition: get.hpp:56
gsl::w_get
auto w_get(w_vector< complex< double > const > *v, size_t i)
Return ith element of vector v with bounds-checking.
Definition: get.hpp:126
gsl::w_get
auto w_get(w_vector< unsigned char const > *v, size_t i)
Return ith element of vector v with bounds-checking.
Definition: get.hpp:116
gsl::w_get
auto w_get(w_vector< unsigned short const > *v, size_t i)
Return ith element of vector v with bounds-checking.
Definition: get.hpp:96
gsl::w_get
auto w_get(w_vector< long double const > *v, size_t i)
Return ith element of vector v with bounds-checking.
Definition: get.hpp:36
gsl::w_get
auto w_get(w_vector< short const > *v, size_t i)
Return ith element of vector v with bounds-checking.
Definition: get.hpp:86
gsl
Namespace for C++-interface to GSL.
Definition: v-iface.hpp:51
gsl::w_get
auto w_get(w_vector< complex< long double > const > *v, size_t i)
Return ith element of vector v with bounds-checking.
Definition: get.hpp:146