MCPcopy Create free account
hub / github.com/boostorg/compute / valarray

Class valarray

include/boost/compute/container/valarray.hpp:37–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35
36template<class T>
37class valarray
38{
39public:
40 explicit valarray(const context &context = system::default_context())
41 : m_buffer(context, 0)
42 {
43 }
44
45 explicit valarray(size_t size,
46 const context &context = system::default_context())
47 : m_buffer(context, size * sizeof(T))
48 {
49 }
50
51 valarray(const T &value,
52 size_t size,
53 const context &context = system::default_context())
54 : m_buffer(context, size * sizeof(T))
55 {
56 fill(begin(), end(), value);
57 }
58
59 valarray(const T *values,
60 size_t size,
61 const context &context = system::default_context())
62 : m_buffer(context, size * sizeof(T))
63 {
64 copy(values, values + size, begin());
65 }
66
67 valarray(const valarray<T> &other)
68 : m_buffer(other.m_buffer.get_context(), other.size() * sizeof(T))
69 {
70 }
71
72 valarray(const std::valarray<T> &valarray,
73 const context &context = system::default_context())
74 : m_buffer(context, valarray.size() * sizeof(T))
75 {
76 copy(&valarray[0], &valarray[valarray.size()], begin());
77 }
78
79 valarray<T>& operator=(const valarray<T> &other)
80 {
81 if(this != &other){
82 resize(other.size());
83 copy(other.begin(), other.end(), begin());
84 }
85
86 return *this;
87 }
88
89 valarray<T>& operator=(const std::valarray<T> &valarray)
90 {
91 resize(valarray.size());
92 copy(&valarray[0], &valarray[valarray.size()], begin());
93
94 return *this;

Callers

nothing calls this directly

Calls 4

copyFunction · 0.85
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected