dune-common
2.9.1
Loading...
Searching...
No Matches
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
// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
4
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
5
6
#ifndef DUNE_COMMON_FILLED_ARRAY_HH
7
#define DUNE_COMMON_FILLED_ARRAY_HH
8
13
#include <array>
14
#include <cstddef>
15
16
namespace
Dune
17
{
24
32
template
<std::
size_t
n,
class
T>
33
constexpr
std::array<T, n>
filledArray
(
const
T&
t
)
34
{
35
std::array<T, n>
arr
{};
36
// this is constexpr in c++17, `arr.fill(t)` is not
37
for
(
auto
&
el
:
arr
)
38
el
=
t
;
39
return
arr
;
40
}
41
44
}
// end namespace Dune
45
46
#endif
// DUNE_COMMON_FILLED_ARRAY_HH
Dune::filledArray
constexpr std::array< T, n > filledArray(const T &t)
Return an array filled with the provided value.
Definition
filledarray.hh:33
Dune
Dune namespace.
Definition
alignedallocator.hh:13
Dune::ArrayList
A dynamically growing random access list.
Definition
arraylist.hh:62
Generated by
1.10.0