Logo ROOT   6.16/01
Reference Guide
RNotFn.hxx
Go to the documentation of this file.
1/// \file ROOT/RNotFn.h
2/// \ingroup Base StdExt
3/// \author Danilo Piparo, Enrico Guiraud
4/// \date 2018-01-19
5
6/*************************************************************************
7 * Copyright (C) 1995-2018, Rene Brun and Fons Rademakers. *
8 * All rights reserved. *
9 * *
10 * For the licensing terms see $ROOTSYS/LICENSE. *
11 * For the list of contributors see $ROOTSYS/README/CREDITS. *
12 *************************************************************************/
13
14#ifndef ROOT_RNotFn
15#define ROOT_RNotFn
16
17#include <functional>
18
19// Backport if not_fn is not available.
20// libc++ does not define __cpp_lib_not_fn.
21// Assume we have not_fn if libc++ is compiled with C++14 and up.
22#if !defined(__cpp_lib_not_fn) && !(defined(_LIBCPP_VERSION) && __cplusplus > 201103L)
23
24#define R__NOTFN_BACKPORT
25
26#include <type_traits> // std::decay
27#include <utility> // std::forward, std::declval
28
29namespace std {
30
31namespace Detail {
32template <typename F>
33class not_fn_t {
35
36public:
37 explicit not_fn_t(F &&f) : fFun(std::forward<F>(f)) {}
38 not_fn_t(not_fn_t &&h) = default;
39 not_fn_t(const not_fn_t &f) = default;
40
41 template <class... Args>
42 auto operator()(Args &&... args) & -> decltype(
44 {
45 return !fFun(std::forward<Args>(args)...);
46 }
47 template <class... Args>
48 auto operator()(Args &&... args) const & -> decltype(
50 {
51 return !fFun(std::forward<Args>(args)...);
52 }
53};
54}
55
56
57template <typename F>
59{
60 return Detail::not_fn_t<F>(std::forward<F>(f));
61}
62}
63
64#endif
65
66#endif
#define f(i)
Definition: RSha256.hxx:104
#define h(i)
Definition: RSha256.hxx:106
int type
Definition: TGX11.cxx:120
auto operator()(Args &&... args) &-> decltype(!std::declval< typename std::result_of< typename std::decay< F >::type(Args...)>::type >())
Definition: RNotFn.hxx:42
auto operator()(Args &&... args) const &-> decltype(!std::declval< typename std::result_of< typename std::decay< F >::type const(Args...)>::type >())
Definition: RNotFn.hxx:48
not_fn_t(const not_fn_t &f)=default
not_fn_t(not_fn_t &&h)=default
std::decay< F >::type fFun
Definition: RNotFn.hxx:34
#define F(x, y, z)
void forward(const LAYERDATA &prevLayerData, LAYERDATA &currLayerData)
apply the weights (and functions) in forward direction of the DNN
Definition: NeuralNet.icc:544
STL namespace.
Detail::not_fn_t< F > not_fn(F &&f)
Definition: RNotFn.hxx:58