6#ifndef DMLC_ARRAY_VIEW_H_
7#define DMLC_ARRAY_VIEW_H_
35template<
typename ValueType>
57 begin_ = other.begin_;
59 other.begin_ =
nullptr;
73 if (other.size() != 0) {
74 begin_ = &other[0]; size_ = other.size();
81 template<std::
size_t size>
84 begin_ = &other[0]; size_ =
size;
99 inline size_t size()
const {
103 inline const ValueType*
begin()
const {
107 inline const ValueType*
end()
const {
108 return begin_ + size_;
121 const ValueType* begin_{
nullptr};
Read only data structure to reference continuous memory region of array. Provide unified view for vec...
Definition array_view.h:36
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
Definition array_view.h:72
array_view(array_view< ValueType > &&other)=default
default move constructor
const ValueType & operator[](size_t i) const
get i-th element from the view
Definition array_view.h:115
array_view(const ValueType *begin, const ValueType *end)
construct array view from continuous segment
Definition array_view.h:92
array_view()=default
default constructor
const ValueType * begin() const
Definition array_view.h:103
const ValueType * end() const
Definition array_view.h:107
array_view(const std::array< ValueType, size > &other)
construct array std::array
Definition array_view.h:82
size_t size() const
Definition array_view.h:99
array_view(const array_view< ValueType > &other)=default
default copy constructor
namespace for dmlc
Definition array_view.h:12