vnl_vector_ref.hxx
Go to the documentation of this file.
1 // This is core/vnl/vnl_vector_ref.hxx
2 #ifndef vnl_vector_ref_hxx_
3 #define vnl_vector_ref_hxx_
4 #include <algorithm>
5 #include <iostream>
6 #include <cstdlib>
7 #include "vnl_vector_ref.h"
8 #include <cassert>
9 #ifdef _MSC_VER
10 # include <vcl_msvc_warnings.h>
11 #endif
12 #include <vnl/vnl_math.h> // for vnl_math::isfinite
13 
14 
15 //------------------------------------------------------------
16 template <typename T>
17 vnl_vector_ref<T>::vnl_vector_ref(unsigned n, T *space) : vnl_vector<T>()
18 {
19  Base::data = space;
20  Base::num_elmts = n;
21 }
22 
23 template <typename T>
25 {
26  Base::data = const_cast<T*>(v.data_block()); // const incorrect!
27  Base::num_elmts = v.size();
28 }
29 
30 template <typename T>
32 {
33  Base::data = nullptr;
34 }
35 
36 template <typename T>
38 {
39  return *this;
40 }
41 
42 #define VNL_VECTOR_REF_INSTANTIATE(T) \
43 template class vnl_vector_ref<T >
44 
45 #endif // vnl_vector_ref_hxx_
vnl_vector_ref & non_const()
Reference to self to make non-const temporaries.
vnl_vector using user-supplied storage
vnl_vector using user-supplied storage.
Definition: vnl_fwd.h:17
Namespace with standard math functions.
#define v
Definition: vnl_vector.h:42
vnl_vector_ref(unsigned n, T *space)
Constructor.
~vnl_vector_ref()
Destructor.
size_t num_elmts
Definition: vnl_vector.h:397
Mathematical vector class, templated by type of element.
Definition: vnl_fwd.h:16