dune-common
2.6-git
dune
common
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
14
namespace
Dune
15
{
21
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
Dune::filledArray
std::array< T, n > filledArray(const T &t)
Return an array filled with the provided value.
Definition:
filledarray.hh:28
Dune
Dune namespace.
Definition:
alignedallocator.hh:9
Generated by
1.8.13