Project
Loading...
Searching...
No Matches
FunctionalHelpers.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.
11#ifndef O2_FRAMEWORK_FUNCTIONALHELPERS_H_
12#define O2_FRAMEWORK_FUNCTIONALHELPERS_H_
13
14#include "Framework/Pack.h"
15#include <algorithm>
16#include <functional>
17
18namespace o2::framework
19{
20
21namespace
22{
23template <typename T>
24struct memfun_type {
25 using type = void;
26};
27} // namespace
28
29template <size_t N>
31 constexpr StringLiteral(const char (&str)[N])
32 {
33 std::copy_n(str, N, value);
34 }
35
36 char value[N];
37};
38
41template <typename Ret, typename Class, typename... Args>
42struct memfun_type<Ret (Class::*)(Args...) const> {
43 using type = std::function<Ret(Args...)>;
44 using args = pack<Args...>;
45 using return_type = Ret;
46};
47
54template <typename F>
55typename memfun_type<decltype(&F::operator())>::type
56 FFL(F const& func)
57{
58 return func;
59}
60
62template <typename F>
63memfun_type<decltype(&F::operator())>
65{
66 return memfun_type<decltype(&F::operator())>();
67}
68
69} // namespace o2::framework
70
71#endif // O2_FRAMEWORK_FUNCTIONALHELPERS_H_
GLenum func
Definition glcorearb.h:778
GLsizei const GLfloat * value
Definition glcorearb.h:819
GLint GLint GLsizei GLint GLenum GLenum type
Definition glcorearb.h:275
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
memfun_type< decltype(&F::operator())> FunctionMetadata(F const &func)
memfun_type< decltype(&F::operator())>::type FFL(F const &func)
constexpr StringLiteral(const char(&str)[N])
const std::string str