proxygen
ThenCompileTest.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014-present Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <folly/futures/Future.h>
21 
22 #include <memory>
23 
24 namespace folly {
25 
26 typedef std::unique_ptr<int> A;
27 struct B {};
28 
29 template <class T>
31 
32 template <class T>
34 
35 template <class T>
37  return makeFuture(T());
38 }
39 
40 template <class Ret, class... Params>
42  typedef typename Ret::value_type T;
43  return makeFuture(T());
44 }
45 
46 template <class Ret, class... Params>
48  return Ret();
49 }
50 
51 template <class Ret, class... Params>
52 std::function<Ret(Params...)> aStdFunction(
53  typename std::enable_if<!isFuture<Ret>::value, bool>::type = false) {
54  return [](Params...) -> Ret { return Ret(); };
55 }
56 
57 template <class Ret, class... Params>
58 std::function<Ret(Params...)> aStdFunction(
59  typename std::enable_if<isFuture<Ret>::value, bool>::type = true) {
60  typedef typename Ret::value_type T;
61  return [](Params...) -> Future<T> { return makeFuture(T()); };
62 }
63 
64 class SomeClass {
65  public:
66  template <class Ret, class... Params>
67  static typename std::enable_if<!isFuture<Ret>::value, Ret>::type
69  return Ret();
70  }
71 
72  template <class Ret, class... Params>
74  Params...) {
75  typedef typename Ret::value_type T;
76  return makeFuture(T());
77  }
78 
79  template <class Ret, class... Params>
80  typename std::enable_if<!isFuture<Ret>::value, Ret>::type aMethod(Params...) {
81  return Ret();
82  }
83 
84  template <class Ret, class... Params>
86  typedef typename Ret::value_type T;
87  return makeFuture(T());
88  }
89 };
90 
91 } // namespace folly
std::unique_ptr< int > A
PskType type
folly::std T
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29
std::enable_if< isFuture< Ret >::value, Ret >::type aFunction(Params...)
static std::enable_if<!isFuture< Ret >::value, Ret >::type aStaticMethod(Params...)
typename std::enable_if<!isFuture< T >::value >::type EnableUnlessFuture
Future< T > someFuture()
typename std::enable_if< isFuture< T >::value >::type EnableIfFuture
std::enable_if<!isFuture< Ret >::value, Ret >::type aMethod(Params...)
static const char *const value
Definition: Conv.cpp:50
static std::enable_if< isFuture< Ret >::value, Ret >::type aStaticMethod(Params...)
std::enable_if< isFuture< Ret >::value, Ret >::type aMethod(Params...)
Future< typename std::decay< T >::type > makeFuture(T &&t)
Definition: Future-inl.h:1310
std::function< Ret(Params...)> aStdFunction(typename std::enable_if<!isFuture< Ret >::value, bool >::type=false)