gslcpp
Modern-C++ Wrapper for GSL
|
Go to the documentation of this file.
6 #include "../wrap/free.hpp"
7 #include "../wrap/vector-alloc.hpp"
8 #include "../wrap/vector-calloc.hpp"
9 #include "../wrap/vector-view-array.hpp"
22 template<
typename T, size_t S= 0>
class v_stor {
36 if(n != S)
throw "mismatch in size";
45 auto const *
v()
const {
return &
cview_.vector; }
68 template<
typename T>
class v_stor<T> {
74 w_vector<T> *
v_=
nullptr;
88 if(a ==
ALLOC)
return w_vector_alloc<T>(n);
89 return w_vector_calloc<T>(n);
108 auto const *
v()
const {
return v_; }
auto * v()
Pointer to GSL's interface to vector.
v_stor(size_t n=S)
Initialize GSL's view of static storage, but do not initialize elements.
void free()
Deallocate vector and its descriptor.
v_stor & operator=(v_stor const &)=delete
Disable copy-assignment.
auto * v()
Reference to GSL's interface to vector.
Generic v_stor is interface to storage with two key properties: (1) that size of storage is known sta...
w_vector< T > * allocate(size_t n, alloc_type a)
Allocate vector and its descriptor.
v_stor(size_t n, alloc_type a=ALLOC)
Allocate vector and its descriptor.
const auto * v() const
Reference to GSL's interface to vector.
v_stor & operator=(v_stor const &)=delete
Disable copy-assignment.
bool valid() const
True if object's data have been validly allocated.
alloc_type
Identifier for each of two possible allocation-methods.
v_stor(v_stor &&src)
Move on construction.
virtual ~v_stor()
Deallocate vector and its descriptor.
v_stor(v_stor const &)=delete
Disable copy-construction.
w_vector_view< T > cview_
GSL's view of data.
@ CALLOC
Initialize each element to zero after allocation.
const auto * v() const
Pointer to GSL's interface to vector.
w_vector< T > * v_
Pointer to allocated descriptor for vector.
Namespace for C++-interface to GSL.
@ ALLOC
Just allocate without initialization.
v_stor(v_stor const &)=delete
Disable copy-construction.