Project
Loading...
Searching...
No Matches
ArrayUtils.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
15
16#ifndef TRACKINGITSU_INCLUDE_ARRAYUTILS_H_
17#define TRACKINGITSU_INCLUDE_ARRAYUTILS_H_
18
19#include <array>
20#include <cstddef>
21#include <utility>
22
23namespace o2
24{
25namespace its
26{
27namespace CA
28{
29
30namespace ArrayUtils
31{
32template <typename T, std::size_t... Is, typename Initializer>
33constexpr std::array<T, sizeof...(Is)> fillArray(Initializer, std::index_sequence<Is...>);
34template <typename T, std::size_t N, typename Initializer>
35constexpr std::array<T, N> fillArray(Initializer);
36} // namespace ArrayUtils
37
38template <typename T, std::size_t... Is, typename Initializer>
39constexpr std::array<T, sizeof...(Is)> ArrayUtils::fillArray(Initializer initializer, std::index_sequence<Is...>)
40{
41 return std::array<T, sizeof...(Is)>{{initializer(Is)...}};
42}
43
44template <typename T, std::size_t N, typename Initializer>
45constexpr std::array<T, N> ArrayUtils::fillArray(Initializer initializer)
46{
47 return ArrayUtils::fillArray<T>(initializer, std::make_index_sequence<N>{});
48}
49} // namespace CA
50} // namespace its
51} // namespace o2
52
53#endif /* TRACKINGITSU_INCLUDE_ARRAYUTILS_H_ */
constexpr std::array< T, sizeof...(Is)> fillArray(Initializer, std::index_sequence< Is... >)
Definition ArrayUtils.h:39
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...