Logo ROOT   6.14/05
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 #if __cplusplus < 201703L && !defined(_MSC_VER)
18 
19 #include <type_traits> // std::decay
20 #include <utility> // std::forward, std::declval
21 
22 namespace std {
23 
24 namespace Detail {
25 template <typename F>
26 class not_fn_t {
28 
29 public:
30  explicit not_fn_t(F &&f) : fFun(std::forward<F>(f)) {}
31  not_fn_t(not_fn_t &&h) = default;
32  not_fn_t(const not_fn_t &f) = default;
33 
34  template <class... Args>
35  auto operator()(Args &&... args) & -> decltype(
36  !std::declval<typename std::result_of<typename std::decay<F>::type(Args...)>::type>())
37  {
38  return !fFun(std::forward<Args>(args)...);
39  }
40  template <class... Args>
41  auto operator()(Args &&... args) const & -> decltype(
42  !std::declval<typename std::result_of<typename std::decay<F>::type const(Args...)>::type>())
43  {
44  return !fFun(std::forward<Args>(args)...);
45  }
46 };
47 }
48 
49 
50 template <typename F>
52 {
53  return Detail::not_fn_t<F>(std::forward<F>(f));
54 }
55 }
56 
57 #else
58 #include <functional>
59 #endif
60 
61 #endif
auto operator()(Args &&... args) &-> decltype(!std::declval< typename std::result_of< typename std::decay< F >::type(Args...)>::type >())
Definition: RNotFn.hxx:35
Detail::not_fn_t< F > not_fn(F &&f)
Definition: RNotFn.hxx:51
#define f(i)
Definition: RSha256.hxx:104
STL namespace.
std::decay< F >::type fFun
Definition: RNotFn.hxx:27
#define F(x, y, z)
#define h(i)
Definition: RSha256.hxx:106
int type
Definition: TGX11.cxx:120
void forward(const LAYERDATA &prevLayerData, LAYERDATA &currLayerData)
apply the weights (and functions) in forward direction of the DNN
Definition: NeuralNet.icc:544
auto operator()(Args &&... args) const &-> decltype(!std::declval< typename std::result_of< typename std::decay< F >::type const(Args...)>::type >())
Definition: RNotFn.hxx:41