Alexandria  2.27.0
SDC-CH common library for the Euclid project
Borrowed.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2022 Euclid Science Ground Segment
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License as published by the Free
6  * Software Foundation; either version 3.0 of the License, or (at your option)
7  * any later version.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef ALEXANDRIA_BORROWED_H
20 #define ALEXANDRIA_BORROWED_H
21 
22 #include <new>
23 
24 namespace Euclid {
25 namespace NdArray {
26 
27 template <typename T>
28 struct BorrowedRange {
29  T* const m_begin;
31 
32  T* data() const {
33  return m_begin;
34  }
35 
36  std::size_t size() const {
37  return m_size;
38  }
39 
40  void resize(std::size_t) const {
41  throw std::bad_alloc();
42  }
43 };
44 
45 } // namespace NdArray
46 } // namespace Euclid
47 
48 #endif // ALEXANDRIA_BORROWED_H
void resize(std::size_t) const
Definition: Borrowed.h:40
std::size_t const m_size
Definition: Borrowed.h:30
std::size_t size() const
Definition: Borrowed.h:36