Logo ROOT   6.18/05
Reference Guide
RHistUtils.hxx
Go to the documentation of this file.
1/// \file ROOT/RHistData.h
2/// \ingroup Hist ROOT7
3/// \author Axel Naumann <axel@cern.ch>
4/// \date 2016-06-01
5/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
6
7/*************************************************************************
8 * Copyright (C) 1995-2016, Rene Brun and Fons Rademakers. *
9 * All rights reserved. *
10 * *
11 * For the licensing terms see $ROOTSYS/LICENSE. *
12 * For the list of contributors see $ROOTSYS/README/CREDITS. *
13 *************************************************************************/
14
15#ifndef ROOT7_RHistUtils_h
16#define ROOT7_RHistUtils_h
17
18#include <array>
19#include <type_traits>
20
21namespace ROOT {
22namespace Experimental {
23namespace Hist {
24
25template <int DIMENSIONS>
26struct RCoordArray: std::array<double, DIMENSIONS> {
27 using Base_t = std::array<double, DIMENSIONS>;
28
29 /// Default construction.
30 RCoordArray() = default;
31
32 /// Construction with one `double` per `DIMENSION`.
33 template<class...ELEMENTS, class = typename std::enable_if<sizeof...(ELEMENTS) + 1 == DIMENSIONS>::type>
34 RCoordArray(double x, ELEMENTS...el): Base_t{{x, el...}} {}
35
36 /// Fallback constructor, invoked if the one above fails because of the wrong number of
37 /// arguments / coordinates.
38 template<class T, class...ELEMENTS, class = typename std::enable_if<sizeof...(ELEMENTS) + 1 != DIMENSIONS>::type>
39 RCoordArray(T, ELEMENTS...) {
40 static_assert(sizeof...(ELEMENTS) + 1 == DIMENSIONS, "Number of coordinates does not match DIMENSIONS");
41 }
42
43 /// Construction from a C-style array.
44 RCoordArray(double (&arr)[DIMENSIONS]): Base_t(arr) {}
45};
46
47template <int DIMENSIONS>
48//using CoordArray_t = std::array<double, DIMENSIONS>;
50
51
52} // namespace Hist
53} // namespace Experimental
54} // namespace ROOT
55
56#endif //ROOT7_THistUtils_h
int type
Definition: TGX11.cxx:120
Double_t x[n]
Definition: legend1.C:17
double T(double x)
Definition: ChebyshevPol.h:34
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
RCoordArray(double x, ELEMENTS...el)
Construction with one double per DIMENSION.
Definition: RHistUtils.hxx:34
RCoordArray(T, ELEMENTS...)
Fallback constructor, invoked if the one above fails because of the wrong number of arguments / coord...
Definition: RHistUtils.hxx:39
std::array< double, DIMENSIONS > Base_t
Definition: RHistUtils.hxx:27
RCoordArray(double(&arr)[DIMENSIONS])
Construction from a C-style array.
Definition: RHistUtils.hxx:44
RCoordArray()=default
Default construction.