]> www.ginac.de Git - cln.git/blob - src/vector/cl_SV_copy.cc
cl_{GV,SV}: use std::size_t for size of vectors (instead of obscure uintC).
[cln.git] / src / vector / cl_SV_copy.cc
1 // copy().
2
3 // General includes.
4 #include "base/cl_sysdep.h"
5
6 // Specification.
7 #define CL_SV_NO_RANGECHECKS
8 #include "cln/SV.h"
9
10
11 // Implementation.
12
13 #include "cln/malloc.h"
14
15 namespace cln {
16
17 const cl_SV_any copy (const cl_SV_any& src)
18 {
19         std::size_t len = src.size();
20         cl_heap_SV_any* hv = (cl_heap_SV_any*) malloc_hook(sizeof(cl_heap_SV_any)+sizeof(cl_gcobject)*len);
21         hv->refcount = 1;
22         hv->type = src.pointer_type();
23         new (&hv->v) cl_SV_inner<cl_gcobject> (len);
24         for (std::size_t i = 0; i < len; i++)
25                 init1(cl_gcobject, hv->v[i]) (src[i]);
26         return hv;
27 }
28
29 }  // namespace cln