Dune Core Modules (2.6.0)

filledarray.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3
4#ifndef DUNE_COMMON_FILLED_ARRAY_HH
5#define DUNE_COMMON_FILLED_ARRAY_HH
6
11#include <array>
12#include <cstddef>
13
14namespace Dune
15{
22
27 template<std::size_t n, class T>
28 std::array<T, n> filledArray(const T& t)
29 {
30 std::array<T, n> arr{};
31 // this would be constexpr in c++17, `arr.fill(t)` is not
32 for(auto &el : arr)
33 el = t;
34 return arr;
35 }
36
39} // end namespace Dune
40
41#endif // DUNE_COMMON_FILLED_ARRAY_HH
std::array< T, n > filledArray(const T &t)
Return an array filled with the provided value.
Definition: filledarray.hh:28
Dune namespace.
Definition: alignedallocator.hh:10
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 26, 23:30, 2024)