Definition of the mgis::function::Buffer type, a container used to store the values of a function, and of the makeSpan helper functions, which build a std::span viewing the content of such a buffer.
More...
#include <span>
#include <array>
#include <vector>
#include <type_traits>
#include <MGIS/Config.hxx>
|
| namespace | mgis |
| | the namespace mgis encloses all the MGIS project.
|
Definition of the mgis::function::Buffer type, a container used to store the values of a function, and of the makeSpan helper functions, which build a std::span viewing the content of such a buffer.
- Author
- Thomas Helfer
- Date
- 30/04/2025
- Copyright
- (C) Copyright Thomas Helfer 2018. Use, modification and distribution are subject to one of the following licences:
- GNU Lesser General Public License (LGPL), Version 3.0. (See accompanying file LGPL-3.0.txt)
- CECILL-C, Version 1.0 (See accompanying files CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt).
◆ Buffer
template<size_type Extent = dynamic_extent>
Initial value:
std::vector<real>,
std::array<real, static_cast<std::size_t>(Extent)>>
constexpr size_type dynamic_extent
a constant whose role is similar to std::dynamic_extent
Definition Config.hxx:143
type used to store the values of a function
A buffer of dynamic size is a std::vector<real>, whereas a buffer whose size is known at compile time is a std::array<real, Extent>, which avoids a dynamic allocation.
- Template Parameters
-
| Extent | number of values stored in the buffer, dynamic_extent if the size of the buffer is only known at run time |
◆ makeSpan() [1/2]
template<std::size_t Extent>
| auto mgis::function::makeSpan |
( |
const std::array< real, Extent > & | b | ) |
|
returns a span viewing the values stored in a fixed size buffer
- Template Parameters
-
- Parameters
-
- Returns
- a std::span viewing the values of the buffer
- Note
- the extent of the returned span is only known at run time if Extent is std::dynamic_extent
◆ makeSpan() [2/2]
| auto mgis::function::makeSpan |
( |
const std::vector< real > & | b | ) |
|
|
inline |
returns a span viewing the values stored in a buffer of dynamic size
- Parameters
-
- Returns
- a std::span viewing the values of the buffer