Read only data structure to reference continuous memory region of array. Provide unified view for vector, array and C style array. This data structure do not guarantee aliveness of referenced array.
More...
|
| array_view ()=default |
| default constructor
|
|
| array_view (const array_view< ValueType > &other)=default |
| default copy constructor
|
|
| array_view (array_view< ValueType > &&other)=default |
| default move constructor
|
|
array_view< ValueType > & | operator= (const array_view< ValueType > &other)=default |
| default assign constructor
|
|
| array_view (const std::vector< ValueType > &other) |
| construct array view std::vector
|
|
template<std::size_t size> |
| array_view (const std::array< ValueType, size > &other) |
| construct array std::array
|
|
| array_view (const ValueType *begin, const ValueType *end) |
| construct array view from continuous segment
|
|
size_t | size () const |
|
const ValueType * | begin () const |
|
const ValueType * | end () const |
|
const ValueType & | operator[] (size_t i) const |
| get i-th element from the view
|
|
template<typename ValueType>
class dmlc::array_view< ValueType >
Read only data structure to reference continuous memory region of array. Provide unified view for vector, array and C style array. This data structure do not guarantee aliveness of referenced array.
Make sure do not use array_view to record data in async function closures. Also do not use array_view to create reference to temporary data structure.
- Template Parameters
-
std::vector<int> myvec{1,2,3};
LOG(INFO) << view[0];
for (int v : view) {
}
Read only data structure to reference continuous memory region of array. Provide unified view for vec...
Definition array_view.h:36