7 #ifndef ALPSCORE_GF_VIEW_H 8 #define ALPSCORE_GF_VIEW_H 34 view(
typename std::remove_cv<T>::type * data,
size_t size) : data_(data), size_(size){}
35 view(
const T* data,
size_t size) : data_(const_cast<T*>(data)), size_(size){}
39 view(data_storage<T>&storage) : data_(storage.data()), size_(storage.
size()) {}
41 view(
const view & view) : data_(view.data_), size_(view.size_) {}
43 view(view && view) : data_(view.data_), size_(view.size_) {}
46 view<T>& operator=(
const view<T> & rhs) {
47 assert(size_ == rhs.size_);
48 std::copy(rhs.data_, rhs.data_+rhs.size_, data_);
53 view<T> operator=(view<T> && rhs) {
54 assert(size_ == rhs.size_);
55 std::copy(rhs.data_, rhs.data_+rhs.size_, data_);
60 inline T& data(
size_t i) {
return data_[i];};
62 inline const T& data(
size_t i)
const {
return data_[i];};
64 size_t size()
const {
return size_;}
66 inline T* data() {
return data_;};
68 inline const T* data()
const {
return data_;};
74 #endif //ALPSCORE_GF_VIEW_H std::enable_if<!is_sequence< T >::value, std::size_t >::type size(T const &)