gslcpp
Modern-C++ Wrapper for GSL
d-vector-view.hpp
Go to the documentation of this file.
1 /// \file include/gslcpp/doc/d-vector-view.hpp
2 /// \brief Narrative documentation for gsl::vector_view.
3 /// \copyright 2022 Thomas E. Vaughan, all rights reserved.
4 
5 /// \page d_vector_view About gsl::vector_view
6 ///
7 /// The template-class gsl::vector_view is one of two descendants of
8 /// gsl::v_iface.
9 ///
10 /// The other is gsl::vector.
11 ///
12 /// gsl::vector_view exists to provide constructors for gsl::v_iface.
13 ///
14 /// - gsl::vector_view provides no interface other than construction.
15 ///
16 /// - gsl::v_iface provides almost all of the interfaces that GSL's native
17 /// vector provides.
18 ///
19 /// - An instance constructed via one of the template-specializations of
20 /// gsl::vector_view does *not* own memory allocated for elements in
21 /// a vector.
22 ///
23 /// - Internally, the return-value of `gsl_vector_view_array()` is stored on
24 /// the stack in the instance of gsl::vector_view.
25 /// - The instance of `gsl_vector_view` returned by `gsl_vector_view_array()`
26 /// consumes about 40 bytes on a 64-bit machine.
27 ///
28 /// - There is on the stack no pointer to the virtual-function table.
29 /// - There is no virtual destructor in the inheritance-chain.
30 ///
31 /// ## Example
32 ///
33 /// The template-parameters to gsl::vector_view often need not be specified
34 /// because they are deduced by the compiler.
35 ///
36 /// Here is an example-program:
37 /// \include vector-view-example.cpp
38 ///
39 /// And here is its output:
40 /// \include vector-view-example.out
41 
42 // EOF