template< -> template <
authorYedidya Feldblum <yfeldblum@fb.com>
Sun, 30 Jul 2017 02:30:13 +0000 (19:30 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Sun, 30 Jul 2017 02:35:30 +0000 (19:35 -0700)
Summary:
[Folly] `template<` -> `template <`.

And then apply `clang-format` style to affected `template <...>` lines.

Reviewed By: andrewjcg

Differential Revision: D5524792

fbshipit-source-id: 6614eecf384bf3e3ccc2f0cc7c5334a0cb9c76af

74 files changed:
folly/AtomicHashArray-inl.h
folly/AtomicHashArray.h
folly/AtomicHashMap-inl.h
folly/AtomicHashMap.h
folly/AtomicStruct.h
folly/AtomicUnorderedMap.h
folly/ConcurrentSkipList-inl.h
folly/ConcurrentSkipList.h
folly/Conv.h
folly/DynamicConverter.h
folly/FBString.h
folly/Hash.h
folly/IPAddress.h
folly/IPAddressV4.h
folly/IPAddressV6.h
folly/IntrusiveList.h
folly/Lazy.h
folly/LifoSem.h
folly/MPMCQueue.h
folly/Memory.h
folly/MemoryMapping.h
folly/Merge.h
folly/PackedSyncPtr.h
folly/PicoSpinLock.h
folly/ProducerConsumerQueue.h
folly/RWSpinLock.h
folly/Range.h
folly/SocketAddress.h
folly/String-inl.h
folly/String.h
folly/Traits.h
folly/detail/AtomicUnorderedMapUtils.h
folly/detail/FileUtilDetail.h
folly/detail/Futex.h
folly/detail/MemoryIdler.h
folly/detail/TurnSequencer.h
folly/dynamic-inl.h
folly/dynamic.h
folly/experimental/LockFreeRingBuffer.h
folly/experimental/test/LockFreeRingBufferTest.cpp
folly/experimental/test/ReadMostlySharedPtrBenchmark.cpp
folly/futures/Future-pre.h
folly/futures/detail/Core.h
folly/futures/helpers.h
folly/io/async/DecoratedAsyncTransportWrapper.h
folly/io/async/EventBaseLocal.h
folly/io/async/EventBaseManager.h
folly/io/async/NotificationQueue.h
folly/io/async/test/UndelayedDestruction.h
folly/json.cpp
folly/small_vector.h
folly/sorted_vector_types.h
folly/test/ApplyTupleTest.cpp
folly/test/AsciiCaseInsensitiveBenchmark.cpp
folly/test/AtomicHashArrayTest.cpp
folly/test/AtomicUnorderedMapTest.cpp
folly/test/ConvTest.cpp
folly/test/FBVectorBenchmark.cpp
folly/test/FBVectorTest.cpp
folly/test/FutexTest.cpp
folly/test/MPMCQueueTest.cpp
folly/test/MemoryIdlerTest.cpp
folly/test/OptionalTest.cpp
folly/test/PackedSyncPtrTest.cpp
folly/test/ProducerConsumerQueueBenchmark.cpp
folly/test/ProducerConsumerQueueTest.cpp
folly/test/RWSpinLockTest.cpp
folly/test/RangeTest.cpp
folly/test/SmallLocksTest.cpp
folly/test/StringTest.cpp
folly/test/SubprocessTest.cpp
folly/test/function_benchmark/benchmark_impl.h
folly/test/small_vector_test.cpp
folly/test/sorted_vector_test.cpp

index d2cb08f460718ed651079f4c3bc47c52253d2b53..ce857a92d31bbb11c36fa1cf555330248e2f9b73 100644 (file)
@@ -370,7 +370,7 @@ struct AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn,
   // Conversion ctor for interoperability between const_iterator and
   // iterator.  The enable_if<> magic keeps us well-behaved for
   // is_convertible<> (v. the iterator_facade documentation).
-  template<class OtherContT, class OtherVal>
+  template <class OtherContT, class OtherVal>
   aha_iterator(const aha_iterator<OtherContT,OtherVal>& o,
                typename std::enable_if<
                std::is_convertible<OtherVal*,IterVal*>::value >::type* = 0)
index e590dad5cdb38b2a882043bc87d0d1b84bfa0672..7dce3a0eb158822898132a45ddce7cdab31ec6dc 100644 (file)
@@ -127,7 +127,7 @@ class AtomicHashArray : boost::noncopyable {
   const KeyT    kLockedKey_;
   const KeyT    kErasedKey_;
 
-  template<class ContT, class IterVal>
+  template <class ContT, class IterVal>
   struct aha_iterator;
 
   typedef aha_iterator<const AtomicHashArray,const value_type> const_iterator;
index e00312662e942b6d6c65eb6287d7191f2f6e4638..25ca05e11da0647ce53372169c6f339b8a3e4069 100644 (file)
@@ -456,7 +456,7 @@ struct AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn,
   // Conversion ctor for interoperability between const_iterator and
   // iterator.  The enable_if<> magic keeps us well-behaved for
   // is_convertible<> (v. the iterator_facade documentation).
-  template<class OtherContT, class OtherVal, class OtherSubIt>
+  template <class OtherContT, class OtherVal, class OtherSubIt>
   ahm_iterator(const ahm_iterator<OtherContT,OtherVal,OtherSubIt>& o,
                typename std::enable_if<
                std::is_convertible<OtherSubIt,SubIt>::value >::type* = 0)
index 962e9de96f8d4a167d75022071fe264cf9e373fb..be683e58a90fd7d2c9131d4593fb1803d1ade30c 100644 (file)
@@ -155,8 +155,14 @@ struct AtomicHashMapFullError : std::runtime_error {
   {}
 };
 
-template<class KeyT, class ValueT, class HashFcn, class EqualFcn,
-         class Allocator, class ProbeFcn, class KeyConvertFcn>
+template <
+    class KeyT,
+    class ValueT,
+    class HashFcn,
+    class EqualFcn,
+    class Allocator,
+    class ProbeFcn,
+    class KeyConvertFcn>
 class AtomicHashMap : boost::noncopyable {
 typedef AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn,
                         Allocator, ProbeFcn, KeyConvertFcn>
@@ -176,7 +182,7 @@ typedef AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn,
   typedef std::size_t         size_type;
   typedef typename SubMap::Config Config;
 
-  template<class ContT, class IterVal, class SubIt>
+  template <class ContT, class IterVal, class SubIt>
   struct ahm_iterator;
 
   typedef ahm_iterator<const AtomicHashMap,
index d15d0d9312e9b96b1e29353724b0819d6b292211..58345f688602304f70a8f11cb8bb2a0770051445 100644 (file)
@@ -33,7 +33,7 @@ template <int N> struct AtomicStructIntPick {};
 /// type <= 8 bytes.
 template <
     typename T,
-    template<typename> class Atom = std::atomic,
+    template <typename> class Atom = std::atomic,
     typename Raw = typename detail::AtomicStructIntPick<sizeof(T)>::type>
 class AtomicStruct {
   static_assert(alignof(T) <= alignof(Raw),
index 3a13aa9f28f3bb5b8832348e93af70f6ac150875..ee39006d187deae36b065876c1bb7edcd84d9ba3 100644 (file)
@@ -129,16 +129,17 @@ namespace folly {
 /// which is much faster than destructing all of the keys and values.
 /// Feel free to override if std::is_trivial_destructor isn't recognizing
 /// the triviality of your destructors.
-template <typename Key,
-          typename Value,
-          typename Hash = std::hash<Key>,
-          typename KeyEqual = std::equal_to<Key>,
-          bool SkipKeyValueDeletion =
-              (boost::has_trivial_destructor<Key>::value &&
-               boost::has_trivial_destructor<Value>::value),
-          template<typename> class Atom = std::atomic,
-          typename IndexType = uint32_t,
-          typename Allocator = folly::detail::MMapAlloc>
+template <
+    typename Key,
+    typename Value,
+    typename Hash = std::hash<Key>,
+    typename KeyEqual = std::equal_to<Key>,
+    bool SkipKeyValueDeletion =
+        (boost::has_trivial_destructor<Key>::value &&
+         boost::has_trivial_destructor<Value>::value),
+    template <typename> class Atom = std::atomic,
+    typename IndexType = uint32_t,
+    typename Allocator = folly::detail::MMapAlloc>
 
 struct AtomicUnorderedInsertMap {
 
@@ -262,7 +263,7 @@ struct AtomicUnorderedInsertMap {
   ///  auto value = memo.findOrConstruct(key, [=](void* raw) {
   ///    new (raw) std::string(computation(key));
   ///  })->first;
-  template<typename Func>
+  template <typename Func>
   std::pair<const_iterator,bool> findOrConstruct(const Key& key, Func&& func) {
     auto const slot = keyToSlotIdx(key);
     auto prev = slots_[slot].headAndState_.load(std::memory_order_acquire);
@@ -314,7 +315,7 @@ struct AtomicUnorderedInsertMap {
   /// Eventually we can duplicate all of the std::pair constructor
   /// forms, including a recursive tuple forwarding template
   /// http://functionalcpp.wordpress.com/2013/08/28/tuple-forwarding/).
-  template<class K, class V>
+  template <class K, class V>
   std::pair<const_iterator,bool> emplace(const K& key, V&& value) {
     return findOrConstruct(key, [&](void* raw) {
       new (raw) Value(std::forward<V>(value));
@@ -501,8 +502,7 @@ using AtomicUnorderedInsertMap64 =
 /// updating values inserted into an AtomicUnorderedInsertMap<K,
 /// MutableAtom<V>>.  This relies on AtomicUnorderedInsertMap's guarantee
 /// that it doesn't move values.
-template <typename T,
-          template<typename> class Atom = std::atomic>
+template <typename T, template <typename> class Atom = std::atomic>
 struct MutableAtom {
   mutable Atom<T> data;
 
index 61279a9652ac1e31b3a023d85c9910903bbc7b9e..ac6023aa4511d057678af6d7d4b70b4a824e5372 100644 (file)
@@ -38,9 +38,9 @@
 
 namespace folly { namespace detail {
 
-template<typename ValT, typename NodeT> class csl_iterator;
+template <typename ValT, typename NodeT> class csl_iterator;
 
-template<typename T>
+template <typename T>
 class SkipListNode : private boost::noncopyable {
   enum : uint16_t {
     IS_HEAD_NODE = 1,
@@ -51,8 +51,11 @@ class SkipListNode : private boost::noncopyable {
  public:
   typedef T value_type;
 
-  template<typename NodeAlloc, typename U,
-    typename=typename std::enable_if<std::is_convertible<U, T>::value>::type>
+  template <
+      typename NodeAlloc,
+      typename U,
+      typename =
+          typename std::enable_if<std::is_convertible<U, T>::value>::type>
   static SkipListNode* create(
       NodeAlloc& alloc, int height, U&& data, bool isHead = false) {
     DCHECK(height >= 1 && height < 64) << height;
@@ -65,13 +68,13 @@ class SkipListNode : private boost::noncopyable {
     return node;
   }
 
-  template<typename NodeAlloc>
+  template <typename NodeAlloc>
   static void destroy(NodeAlloc& alloc, SkipListNode* node) {
     node->~SkipListNode();
     alloc.deallocate(node);
   }
 
-  template<typename NodeAlloc>
+  template <typename NodeAlloc>
   struct DestroyIsNoOp : std::integral_constant<bool,
     IsArenaAllocator<NodeAlloc>::value &&
     boost::has_trivial_destructor<SkipListNode>::value> { };
@@ -130,7 +133,7 @@ class SkipListNode : private boost::noncopyable {
 
  private:
   // Note! this can only be called from create() as a placement new.
-  template<typename U>
+  template <typename U>
   SkipListNode(uint8_t height, U&& data, bool isHead) :
       height_(height), data_(std::forward<U>(data)) {
     spinLock_.init();
@@ -226,10 +229,10 @@ class SkipListRandomHeight {
   size_t sizeLimitTable_[kMaxHeight];
 };
 
-template<typename NodeType, typename NodeAlloc, typename = void>
+template <typename NodeType, typename NodeAlloc, typename = void>
 class NodeRecycler;
 
-template<typename NodeType, typename NodeAlloc>
+template <typename NodeType, typename NodeAlloc>
 class NodeRecycler<NodeType, NodeAlloc, typename std::enable_if<
   !NodeType::template DestroyIsNoOp<NodeAlloc>::value>::type> {
  public:
@@ -315,7 +318,7 @@ class NodeRecycler<NodeType, NodeAlloc, typename std::enable_if<
 
 // In case of arena allocator, no recycling is necessary, and it's possible
 // to save on ConcurrentSkipList size.
-template<typename NodeType, typename NodeAlloc>
+template <typename NodeType, typename NodeAlloc>
 class NodeRecycler<NodeType, NodeAlloc, typename std::enable_if<
   NodeType::template DestroyIsNoOp<NodeAlloc>::value>::type> {
  public:
index a1a694a6e3f297344a73ce33dcb7aff5ac9327bb..1a2fdadcd5d6f71fb638aaa52b23de0689fa1548 100644 (file)
@@ -135,12 +135,13 @@ Sample usage:
 
 namespace folly {
 
-template<typename T,
-         typename Comp = std::less<T>,
-         // All nodes are allocated using provided SimpleAllocator,
-         // it should be thread-safe.
-         typename NodeAlloc = SysAlloc,
-         int MAX_HEIGHT = 24>
+template <
+    typename T,
+    typename Comp = std::less<T>,
+    // All nodes are allocated using provided SimpleAllocator,
+    // it should be thread-safe.
+    typename NodeAlloc = SysAlloc,
+    int MAX_HEIGHT = 24>
 class ConcurrentSkipList {
   // MAX_HEIGHT needs to be at least 2 to suppress compiler
   // warnings/errors (Werror=uninitialized tiggered due to preds_[1]
@@ -297,7 +298,7 @@ class ConcurrentSkipList {
   //     list with the same key.
   //   pair.second stores whether the data is added successfully:
   //     0 means not added, otherwise reutrns the new size.
-  template<typename U>
+  template <typename U>
   std::pair<NodeType*, size_t> addOrGetData(U &&data) {
     NodeType *preds[MAX_HEIGHT], *succs[MAX_HEIGHT];
     NodeType *newNode;
@@ -518,7 +519,7 @@ class ConcurrentSkipList {
   std::atomic<size_t> size_;
 };
 
-template<typename T, typename Comp, typename NodeAlloc, int MAX_HEIGHT>
+template <typename T, typename Comp, typename NodeAlloc, int MAX_HEIGHT>
 class ConcurrentSkipList<T, Comp, NodeAlloc, MAX_HEIGHT>::Accessor {
   typedef detail::SkipListNode<T> NodeType;
   typedef ConcurrentSkipList<T, Comp, NodeAlloc, MAX_HEIGHT> SkipListType;
@@ -593,8 +594,10 @@ class ConcurrentSkipList<T, Comp, NodeAlloc, MAX_HEIGHT>::Accessor {
   const_iterator cbegin() const { return begin(); }
   const_iterator cend() const { return end(); }
 
-  template<typename U,
-    typename=typename std::enable_if<std::is_convertible<U, T>::value>::type>
+  template <
+      typename U,
+      typename =
+          typename std::enable_if<std::is_convertible<U, T>::value>::type>
   std::pair<iterator, bool> insert(U&& data) {
     auto ret = sl_->addOrGetData(std::forward<U>(data));
     return std::make_pair(iterator(ret.first), ret.second);
@@ -652,7 +655,7 @@ class ConcurrentSkipList<T, Comp, NodeAlloc, MAX_HEIGHT>::Accessor {
 };
 
 // implements forward iterator concept.
-template<typename ValT, typename NodeT>
+template <typename ValT, typename NodeT>
 class detail::csl_iterator :
   public boost::iterator_facade<csl_iterator<ValT, NodeT>,
     ValT, boost::forward_traversal_tag> {
@@ -664,7 +667,7 @@ class detail::csl_iterator :
 
   explicit csl_iterator(NodeT* node = nullptr) : node_(node) {}
 
-  template<typename OtherVal, typename OtherNode>
+  template <typename OtherVal, typename OtherNode>
   csl_iterator(const csl_iterator<OtherVal, OtherNode> &other,
       typename std::enable_if<std::is_convertible<OtherVal, ValT>::value>::type*
       = 0) : node_(other.node_) {}
@@ -678,7 +681,7 @@ class detail::csl_iterator :
 
  private:
   friend class boost::iterator_core_access;
-  template<class,class> friend class csl_iterator;
+  template <class, class> friend class csl_iterator;
 
   void increment() { node_ = node_->next(); }
   bool equal(const csl_iterator& other) const { return node_ == other.node_; }
@@ -688,7 +691,7 @@ class detail::csl_iterator :
 };
 
 // Skipper interface
-template<typename T, typename Comp, typename NodeAlloc, int MAX_HEIGHT>
+template <typename T, typename Comp, typename NodeAlloc, int MAX_HEIGHT>
 class ConcurrentSkipList<T, Comp, NodeAlloc, MAX_HEIGHT>::Skipper {
   typedef detail::SkipListNode<T> NodeType;
   typedef ConcurrentSkipList<T, Comp, NodeAlloc, MAX_HEIGHT> SkipListType;
index 72518d808f5ad895ad04c33eadb5a87a711f5cc9..d70b1d5bc2427f39f2357b04a00055c6380cc0a7 100644 (file)
@@ -400,7 +400,7 @@ void toAppend(char value, Tgt * result) {
   *result += value;
 }
 
-template<class T>
+template <class T>
 constexpr typename std::enable_if<
   std::is_same<T, char>::value,
   size_t>::type
@@ -435,7 +435,7 @@ typename std::enable_if<std::is_convertible<Src, const char*>::value, size_t>::
   return 0;
 }
 
-template<class Src>
+template <class Src>
 typename std::enable_if<
   (std::is_convertible<Src, folly::StringPiece>::value ||
   IsSomeString<Src>::value) &&
@@ -450,7 +450,7 @@ inline size_t estimateSpaceNeeded(std::nullptr_t /* value */) {
   return 0;
 }
 
-template<class Src>
+template <class Src>
 typename std::enable_if<
   std::is_pointer<Src>::value &&
   IsSomeString<std::remove_pointer<Src>>::value,
@@ -523,7 +523,7 @@ toAppend(unsigned __int128 value, Tgt * result) {
   result->append(buffer + p, buffer + sizeof(buffer));
 }
 
-template<class T>
+template <class T>
 constexpr typename std::enable_if<
   std::is_same<T, __int128>::value,
   size_t>::type
@@ -531,7 +531,7 @@ estimateSpaceNeeded(T) {
   return detail::digitsEnough<__int128>();
 }
 
-template<class T>
+template <class T>
 constexpr typename std::enable_if<
   std::is_same<T, unsigned __int128>::value,
   size_t>::type
@@ -742,7 +742,7 @@ estimateSpaceNeeded(Src value) {
  * for estimateSpaceNeed for your type, so that we allocate
  * as much as you need instead of the default
  */
-template<class Src>
+template <class Src>
 struct HasLengthEstimator : std::false_type {};
 
 template <class Src>
@@ -776,12 +776,12 @@ size_t estimateSpaceToReserve(size_t sofar, const T& v, const Ts&... vs) {
   return estimateSpaceToReserve(sofar + estimateSpaceNeeded(v), vs...);
 }
 
-template<class...Ts>
+template <class... Ts>
 void reserveInTarget(const Ts&...vs) {
   getLastElement(vs...)->reserve(estimateSpaceToReserve(0, vs...));
 }
 
-template<class Delimiter, class...Ts>
+template <class Delimiter, class... Ts>
 void reserveInTargetDelim(const Delimiter& d, const Ts&...vs) {
   static_assert(sizeof...(vs) >= 2, "Needs at least 2 args");
   size_t fordelim = (sizeof...(vs) - 2) *
index f29737a8e97ebfa4d6f39e52d83f272faff3204c..e63bf842666c58ad6d19db25b262cfd736e13a6a 100644 (file)
@@ -100,7 +100,7 @@ using is_associative = StrictConjunction<is_range<T>, has_key_type<T>>;
 
 namespace dynamicconverter_detail {
 
-template<typename T>
+template <typename T>
 struct Dereferencer {
   static inline void derefToCache(
       Optional<T>* /* mem */,
@@ -115,7 +115,7 @@ struct Dereferencer {
   }
 };
 
-template<typename F, typename S>
+template <typename F, typename S>
 struct Dereferencer<std::pair<F, S>> {
   static inline void derefToCache(
       Optional<std::pair<F, S>>* mem,
@@ -356,7 +356,7 @@ struct DynamicConstructor<
 };
 
 // pair
-template<typename A, typename B>
+template <typename A, typename B>
 struct DynamicConstructor<std::pair<A, B>, void> {
   static dynamic construct(const std::pair<A, B>& x) {
     dynamic d = dynamic::array;
@@ -374,7 +374,7 @@ T convertTo(const dynamic& d) {
   return DynamicConverter<typename std::remove_cv<T>::type>::convert(d);
 }
 
-template<typename T>
+template <typename T>
 dynamic toDynamic(const T& x) {
   return DynamicConstructor<typename std::remove_cv<T>::type>::construct(x);
 }
index 5d32df535f6d2a268923218881061cb40e23c3a5..b36bb948f04d9b5927cd79c56b65c30d8426ebc2 100644 (file)
@@ -1404,7 +1404,7 @@ public:
 
   basic_fbstring& append(size_type n, value_type c);
 
-  template<class InputIterator>
+  template <class InputIterator>
   basic_fbstring& append(InputIterator first, InputIterator last) {
     insert(end(), first, last);
     return *this;
index e8b75df377972be27b4673679c96fb18e7534061..78bb5f4819135f7aaf9eabf13a74552dc78c88a1 100644 (file)
@@ -370,7 +370,7 @@ inline uint32_t hsieh_hash32_str(const std::string& str) {
 
 } // namespace hash
 
-template<class Key, class Enable = void>
+template <class Key, class Enable = void>
 struct hasher;
 
 struct Hash {
@@ -393,43 +393,43 @@ struct hasher<bool> {
   }
 };
 
-template<> struct hasher<int32_t> {
+template <> struct hasher<int32_t> {
   size_t operator()(int32_t key) const {
     return hash::jenkins_rev_mix32(uint32_t(key));
   }
 };
 
-template<> struct hasher<uint32_t> {
+template <> struct hasher<uint32_t> {
   size_t operator()(uint32_t key) const {
     return hash::jenkins_rev_mix32(key);
   }
 };
 
-template<> struct hasher<int16_t> {
+template <> struct hasher<int16_t> {
   size_t operator()(int16_t key) const {
     return hasher<int32_t>()(key); // as impl accident, sign-extends
   }
 };
 
-template<> struct hasher<uint16_t> {
+template <> struct hasher<uint16_t> {
   size_t operator()(uint16_t key) const {
     return hasher<uint32_t>()(key);
   }
 };
 
-template<> struct hasher<int8_t> {
+template <> struct hasher<int8_t> {
   size_t operator()(int8_t key) const {
     return hasher<int32_t>()(key); // as impl accident, sign-extends
   }
 };
 
-template<> struct hasher<uint8_t> {
+template <> struct hasher<uint8_t> {
   size_t operator()(uint8_t key) const {
     return hasher<uint32_t>()(key);
   }
 };
 
-template<> struct hasher<char> {
+template <> struct hasher<char> {
   using explicit_type =
       std::conditional<std::is_signed<char>::value, int8_t, uint8_t>::type;
   size_t operator()(char key) const {
@@ -437,19 +437,19 @@ template<> struct hasher<char> {
   }
 };
 
-template<> struct hasher<int64_t> {
+template <> struct hasher<int64_t> {
   size_t operator()(int64_t key) const {
     return static_cast<size_t>(hash::twang_mix64(uint64_t(key)));
   }
 };
 
-template<> struct hasher<uint64_t> {
+template <> struct hasher<uint64_t> {
   size_t operator()(uint64_t key) const {
     return static_cast<size_t>(hash::twang_mix64(key));
   }
 };
 
-template<> struct hasher<std::string> {
+template <> struct hasher<std::string> {
   size_t operator()(const std::string& key) const {
     return static_cast<size_t>(
         hash::SpookyHashV2::Hash64(key.data(), key.size(), 0));
index 4ed42a983f48c1335ebd4cc8bff45b93acad1659..372d9cbc5a19c418e53e7ff178c79549c7ca5174 100644 (file)
@@ -460,7 +460,7 @@ inline bool operator>=(const IPAddress& a, const IPAddress& b) {
 }  // folly
 
 namespace std {
-template<>
+template <>
 struct hash<folly::IPAddress> {
   size_t operator()(const folly::IPAddress& addr) const {
     return addr.hash();
index 1e2c65e7f91d60a895dcd3915bf996d338635ab7..b6390f8c423621ffcb6086264ba64bd2c6eec06f 100644 (file)
@@ -311,7 +311,7 @@ inline bool operator>=(const IPAddressV4& a, const IPAddressV4& b) {
 }  // folly
 
 namespace std {
-template<>
+template <>
 struct hash<folly::IPAddressV4> {
   size_t operator()(const folly::IPAddressV4 addr) const {
     return addr.hash();
index d0c5cd609dc2b4fadc02054bfdcda693afc8e3f4..d2fd02a91b891be5b500fce4dfd767a8927f5e24 100644 (file)
@@ -398,7 +398,7 @@ void toAppend(IPAddressV6 addr, fbstring* result);
 }  // folly
 
 namespace std {
-template<>
+template <>
 struct hash<folly::IPAddressV6> {
   size_t operator()(const folly::IPAddressV6& addr) const {
     return addr.hash();
index 0c799f1b11a659295d8be1d4947e3a59eb2fc3e1..ffd5c9b734a60447f5616e3a0aaafc5d41b14a5c 100644 (file)
@@ -61,7 +61,7 @@ using IntrusiveListHook = boost::intrusive::list_member_hook<
  * The elements stored in the list must contain an IntrusiveListHook member
  * variable.
  */
-template<typename T, IntrusiveListHook T::* PtrToMember>
+template <typename T, IntrusiveListHook T::*PtrToMember>
 using IntrusiveList = boost::intrusive::list<
     T,
     boost::intrusive::member_hook<T, IntrusiveListHook, PtrToMember>,
@@ -109,7 +109,7 @@ using SafeIntrusiveListHook = boost::intrusive::list_member_hook<
  * The elements stored in the list must contain an SafeIntrusiveListHook member
  * variable.
  */
-template<typename T, SafeIntrusiveListHook T::* PtrToMember>
+template <typename T, SafeIntrusiveListHook T::*PtrToMember>
 using CountedIntrusiveList = boost::intrusive::list<
     T,
     boost::intrusive::member_hook<T, SafeIntrusiveListHook, PtrToMember>,
index 32723bc1053694188580736f05fe6f74b97b428f..963dd479a8889c7e01028cc18ea09c7a4e133a23 100644 (file)
@@ -86,7 +86,7 @@ namespace folly {
 
 namespace detail {
 
-template<class Func>
+template <class Func>
 struct Lazy {
   typedef typename std::result_of<Func()>::type result_type;
 
@@ -120,7 +120,7 @@ private:
 
 //////////////////////////////////////////////////////////////////////
 
-template<class Func>
+template <class Func>
 detail::Lazy<typename std::remove_reference<Func>::type>
 lazy(Func&& fun) {
   return detail::Lazy<typename std::remove_reference<Func>::type>(
index 8fc46ae24589d22e96d4c21943af4fc30010d926..90176094a857c6d0e573a1f0dee46dcd2e7573c2 100644 (file)
@@ -31,8 +31,9 @@
 
 namespace folly {
 
-template <template<typename> class Atom = std::atomic,
-          class BatonType = Baton<Atom>>
+template <
+    template <typename> class Atom = std::atomic,
+    class BatonType = Baton<Atom>>
 struct LifoSemImpl;
 
 /// LifoSem is a semaphore that wakes its waiters in a manner intended to
@@ -114,7 +115,7 @@ namespace detail {
 /// LifoSemRawNode is the actual pooled storage that backs LifoSemNode
 /// for user-specified Handoff types.  This is done so that we can have
 /// a large static IndexedMemPool of nodes, instead of per-type pools
-template <template<typename> class Atom>
+template <template <typename> class Atom>
 struct LifoSemRawNode {
   std::aligned_storage<sizeof(void*),alignof(void*)>::type raw;
 
@@ -151,7 +152,7 @@ struct LifoSemRawNode {
 /// If it has a wait() method then LifoSemBase's wait() implementation
 /// will work out of the box, otherwise you will need to specialize
 /// LifoSemBase::wait accordingly.
-template <typename Handoff, template<typename> class Atom>
+template <typename Handoff, template <typename> class Atom>
 struct LifoSemNode : public LifoSemRawNode<Atom> {
 
   static_assert(sizeof(Handoff) <= sizeof(LifoSemRawNode<Atom>::raw),
@@ -181,7 +182,7 @@ struct LifoSemNode : public LifoSemRawNode<Atom> {
   }
 };
 
-template <typename Handoff, template<typename> class Atom>
+template <typename Handoff, template <typename> class Atom>
 struct LifoSemNodeRecycler {
   void operator()(LifoSemNode<Handoff,Atom>* elem) const {
     elem->destroy();
@@ -316,8 +317,7 @@ class LifoSemHead {
 ///
 /// The Handoff type is responsible for arranging one wakeup notification.
 /// See LifoSemNode for more information on how to make your own.
-template <typename Handoff,
-          template<typename> class Atom = std::atomic>
+template <typename Handoff, template <typename> class Atom = std::atomic>
 struct LifoSemBase {
 
   /// Constructor
@@ -591,7 +591,7 @@ struct LifoSemBase {
 
 } // namespace detail
 
-template <template<typename> class Atom, class BatonType>
+template <template <typename> class Atom, class BatonType>
 struct LifoSemImpl : public detail::LifoSemBase<BatonType, Atom> {
   constexpr explicit LifoSemImpl(uint32_t v = 0)
     : detail::LifoSemBase<BatonType, Atom>(v) {}
index 6ae222da10fd56fa229c79ba0302897f69fa1315..03c85e473c3bbdea95e1ee5187c7aba0b8d77d3e 100644 (file)
@@ -34,7 +34,7 @@ namespace folly {
 
 namespace detail {
 
-template<typename T, template<typename> class Atom>
+template <typename T, template <typename> class Atom>
 struct SingleElementQueue;
 
 template <typename T> class MPMCPipelineStageImpl;
@@ -97,8 +97,10 @@ template <typename> class MPMCQueueBase;
 /// are you can enqueue one sentinel and then have each consumer requeue
 /// two sentinels after it receives it (by requeuing 2 the shutdown can
 /// complete in O(log P) time instead of O(P)).
-template<typename T, template<typename> class Atom = std::atomic,
-         bool Dynamic = false>
+template <
+    typename T,
+    template <typename> class Atom = std::atomic,
+    bool Dynamic = false>
 class MPMCQueue : public detail::MPMCQueueBase<MPMCQueue<T,Atom,Dynamic>> {
   friend class detail::MPMCPipelineStageImpl<T>;
   using Slot = detail::SingleElementQueue<T,Atom>;
@@ -169,7 +171,7 @@ class MPMCQueue : public detail::MPMCQueueBase<MPMCQueue<T,Atom,Dynamic>> {
 ///
 /// The dynamic version is a partial specialization of MPMCQueue with
 /// Dynamic == true
-template <typename T, template<typename> class Atom>
+template <typename T, template <typename> class Atom>
 class MPMCQueue<T,Atom,true> :
       public detail::MPMCQueueBase<MPMCQueue<T,Atom,true>> {
   friend class detail::MPMCQueueBase<MPMCQueue<T,Atom,true>>;
@@ -613,10 +615,12 @@ class MPMCQueue<T,Atom,true> :
 namespace detail {
 
 /// CRTP specialization of MPMCQueueBase
-template<
-  template<
-    typename T, template<typename> class Atom, bool Dynamic> class Derived,
-  typename T, template<typename> class Atom, bool Dynamic>
+template <
+    template <typename T, template <typename> class Atom, bool Dynamic>
+    class Derived,
+    typename T,
+    template <typename> class Atom,
+    bool Dynamic>
 class MPMCQueueBase<Derived<T, Atom, Dynamic>> : boost::noncopyable {
 
 // Note: Using CRTP static casts in several functions of this base
index 272d64dc68da5b6e997f6acb49e92be5d0d0a4b2..0ff1983f50c5d5cabe07004e1653d41d0a91011e 100644 (file)
@@ -43,21 +43,21 @@ namespace folly {
 
 #else
 
-template<typename T, typename... Args>
+template <typename T, typename... Args>
 typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
 make_unique(Args&&... args) {
   return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
 }
 
 // Allows 'make_unique<T[]>(10)'. (N3690 s20.9.1.4 p3-4)
-template<typename T>
+template <typename T>
 typename std::enable_if<std::is_array<T>::value, std::unique_ptr<T>>::type
 make_unique(const size_t n) {
   return std::unique_ptr<T>(new typename std::remove_extent<T>::type[n]());
 }
 
 // Disallows 'make_unique<T[10]>()'. (N3690 s20.9.1.4 p5)
-template<typename T, typename... Args>
+template <typename T, typename... Args>
 typename std::enable_if<
   std::extent<T>::value != 0, std::unique_ptr<T>>::type
 make_unique(Args&&...) = delete;
index c05bad755de080795d4da25084e58df3e3898d5d..2ceede771ce2b61d7097d55d2535109d6d7604a5 100644 (file)
@@ -162,7 +162,7 @@ class MemoryMapping : boost::noncopyable {
    * A bitwise cast of the mapped bytes as range of values. Only intended for
    * use with POD or in-place usable types.
    */
-  template<class T>
+  template <class T>
   Range<const T*> asRange() const {
     size_t count = data_.size() / sizeof(T);
     return Range<const T*>(static_cast<const T*>(
@@ -181,7 +181,7 @@ class MemoryMapping : boost::noncopyable {
    * A bitwise cast of the mapped bytes as range of mutable values. Only
    * intended for use with POD or in-place usable types.
    */
-  template<class T>
+  template <class T>
   Range<T*> asWritableRange() const {
     DCHECK(options_.writable);  // you'll segfault anyway...
     size_t count = data_.size() / sizeof(T);
index f8d1fc1ea7d86549cb6bf373a7e92d24e8bfee75..1979ae716098ef4aa002d748adbc112d667e24d1 100644 (file)
@@ -42,7 +42,7 @@
 
 namespace folly {
 
-template<class InputIt1, class InputIt2, class OutputIt, class Compare>
+template <class InputIt1, class InputIt2, class OutputIt, class Compare>
 OutputIt merge(InputIt1 first1, InputIt1 last1,
                InputIt2 first2, InputIt2 last2,
                OutputIt d_first, Compare comp) {
@@ -61,7 +61,7 @@ OutputIt merge(InputIt1 first1, InputIt1 last1,
   return std::copy(first2, last2, d_first);
 }
 
-template<class InputIt1, class InputIt2, class OutputIt>
+template <class InputIt1, class InputIt2, class OutputIt>
 OutputIt merge(InputIt1 first1, InputIt1 last1,
                InputIt2 first2, InputIt2 last2,
                OutputIt d_first) {
index 692fbf9bac43dd4a9121452e6d9e8e0ebf4c3a93..f5f4eb9ee3595aa55e9910df75cbc30fc43c520f 100644 (file)
@@ -59,7 +59,7 @@
 
 namespace folly {
 
-template<class T>
+template <class T>
 class PackedSyncPtr {
   // This just allows using this class even with T=void.  Attempting
   // to use the operator* or operator[] on a PackedSyncPtr<void> will
index f0a7d12e32c730d824d9ecdd7109a5f7dde32d81..4280e653d6b2014c5710b69c0513b5a7c73067ae 100644 (file)
@@ -69,7 +69,7 @@ namespace folly {
  * have a real constructor because we want this to be a POD type so we
  * can put it into packed structs.
  */
-template<class IntType, int Bit = sizeof(IntType) * 8 - 1>
+template <class IntType, int Bit = sizeof(IntType) * 8 - 1>
 struct PicoSpinLock {
   // Internally we deal with the unsigned version of the type.
   typedef typename std::make_unsigned<IntType>::type UIntType;
index 12f2bf427c33ce9485ac393d42097f6b1a1a1741..13948be45218e374777a012ad392d8c59c44cb76 100644 (file)
@@ -35,7 +35,7 @@ namespace folly {
  * ProducerConsumerQueue is a one producer and one consumer queue
  * without locks.
  */
-template<class T>
+template <class T>
 struct ProducerConsumerQueue {
   typedef T value_type;
 
@@ -77,7 +77,7 @@ struct ProducerConsumerQueue {
     std::free(records_);
   }
 
-  template<class ...Args>
+  template <class... Args>
   bool write(Args&&... recordArgs) {
     auto const currentWrite = writeIndex_.load(std::memory_order_relaxed);
     auto nextRecord = currentWrite + 1;
index 21df0c0dae17ba31d48b94f6cb519de4603d568e..8aca5966d602538bd4965b79e2c5d32ea3a53a91 100644 (file)
@@ -519,8 +519,7 @@ struct RWTicketIntTrait<32> {
 };
 }  // detail
 
-
-template<size_t kBitWidth, bool kFavorWriter=false>
+template <size_t kBitWidth, bool kFavorWriter = false>
 class RWTicketSpinLockT {
   typedef detail::RWTicketIntTrait<kBitWidth> IntTraitType;
   typedef typename detail::RWTicketIntTrait<kBitWidth>::FullInt FullInt;
@@ -540,13 +539,13 @@ class RWTicketSpinLockT {
   } ticket;
 
  private: // Some x64-specific utilities for atomic access to ticket.
-  template<class T> static T load_acquire(T* addr) {
+  template <class T> static T load_acquire(T* addr) {
     T t = *addr; // acquire barrier
     asm_volatile_memory();
     return t;
   }
 
-  template<class T>
+  template <class T>
   static void store_release(T* addr, T v) {
     asm_volatile_memory();
     *addr = v; // release barrier
index a2c1d96cc91153e87f1843fb8a4c6b38a4e5cb5a..3ccf8685a795557074babb04653423463e81fabb 100644 (file)
@@ -1259,7 +1259,7 @@ inline size_t qfind_first_of(const Range<const unsigned char*>& haystack,
                                      StringPiece(needles));
 }
 
-template<class Key, class Enable>
+template <class Key, class Enable>
 struct hasher;
 
 template <class T>
index 480a37d94941f02a577942f62e9373f716fd02e7..54fc6a36069471d0789fa8bcfd91ce1acaaec443 100644 (file)
@@ -621,7 +621,7 @@ std::ostream& operator<<(std::ostream& os, const SocketAddress& addr);
 namespace std {
 
 // Provide an implementation for std::hash<SocketAddress>
-template<>
+template <>
 struct hash<folly::SocketAddress> {
   size_t operator()(
       const folly::SocketAddress& addr) const {
index c28b6e5dd4ccfae8f95697c144222d3f4ed87e66..f3eee8eda3d77e341c34546520688f88a3edd41c 100644 (file)
@@ -275,7 +275,7 @@ inline char delimFront(StringPiece s) {
  *
  * @param ignoreEmpty iff true, don't copy empty segments to output
  */
-template<class OutStringT, class DelimT, class OutputIterator>
+template <class OutStringT, class DelimT, class OutputIterator>
 void internalSplit(DelimT delim, StringPiece sp, OutputIterator out,
     bool ignoreEmpty) {
   assert(sp.empty() || sp.start() != nullptr);
@@ -317,7 +317,7 @@ void internalSplit(DelimT delim, StringPiece sp, OutputIterator out,
   }
 }
 
-template<class String> StringPiece prepareDelim(const String& s) {
+template <class String> StringPiece prepareDelim(const String& s) {
   return StringPiece(s);
 }
 inline char prepareDelim(char c) { return c; }
@@ -359,7 +359,7 @@ bool splitFixed(
 
 //////////////////////////////////////////////////////////////////////
 
-template<class Delim, class String, class OutputType>
+template <class Delim, class String, class OutputType>
 void split(const Delim& delimiter,
            const String& input,
            std::vector<OutputType>& out,
@@ -371,7 +371,7 @@ void split(const Delim& delimiter,
     ignoreEmpty);
 }
 
-template<class Delim, class String, class OutputType>
+template <class Delim, class String, class OutputType>
 void split(const Delim& delimiter,
            const String& input,
            fbvector<OutputType>& out,
@@ -383,8 +383,11 @@ void split(const Delim& delimiter,
     ignoreEmpty);
 }
 
-template<class OutputValueType, class Delim, class String,
-         class OutputIterator>
+template <
+    class OutputValueType,
+    class Delim,
+    class String,
+    class OutputIterator>
 void splitTo(const Delim& delimiter,
              const String& input,
              OutputIterator out,
@@ -567,7 +570,7 @@ void humanify(const String1& input, String2& output) {
   }
 }
 
-template<class InputString, class OutputString>
+template <class InputString, class OutputString>
 bool hexlify(const InputString& input, OutputString& output,
              bool append_output) {
   if (!append_output) output.clear();
@@ -583,7 +586,7 @@ bool hexlify(const InputString& input, OutputString& output,
   return true;
 }
 
-template<class InputString, class OutputString>
+template <class InputString, class OutputString>
 bool unhexlify(const InputString& input, OutputString& output) {
   if (input.size() % 2 != 0) {
     return false;
index c57a255b3f1f857b76afd0c32c92066df2496008..5570b7b9b46af33d2dba9726415ebf21f9f01b86 100644 (file)
@@ -249,7 +249,7 @@ String humanify(const String& input) {
  * If append_output is true, append data to the output rather than
  * replace it.
  */
-template<class InputString, class OutputString>
+template <class InputString, class OutputString>
 bool hexlify(const InputString& input, OutputString& output,
              bool append=false);
 
@@ -272,7 +272,7 @@ OutputString hexlify(StringPiece input) {
  * Same functionality as Python's binascii.unhexlify.  Returns true
  * on successful conversion.
  */
-template<class InputString, class OutputString>
+template <class InputString, class OutputString>
 bool unhexlify(const InputString& input, OutputString& output);
 
 template <class OutputString = std::string>
@@ -409,20 +409,23 @@ fbstring errnoStr(int err);
  * or not (generating empty tokens).
  */
 
-template<class Delim, class String, class OutputType>
+template <class Delim, class String, class OutputType>
 void split(const Delim& delimiter,
            const String& input,
            std::vector<OutputType>& out,
            const bool ignoreEmpty = false);
 
-template<class Delim, class String, class OutputType>
+template <class Delim, class String, class OutputType>
 void split(const Delim& delimiter,
            const String& input,
            folly::fbvector<OutputType>& out,
            const bool ignoreEmpty = false);
 
-template<class OutputValueType, class Delim, class String,
-         class OutputIterator>
+template <
+    class OutputValueType,
+    class Delim,
+    class String,
+    class OutputIterator>
 void splitTo(const Delim& delimiter,
              const String& input,
              OutputIterator out,
index eed02dc620a37e0bce2fdb123e570550196c9a56..bf8d4b4cbc3dc0d665459500f9e13658a6d4f7ae 100644 (file)
@@ -402,12 +402,12 @@ struct StrictDisjunction
  * regular type, use it like this:
  *
  * // Make sure you're at namespace ::folly scope
- * template<> FOLLY_ASSUME_RELOCATABLE(MyType)
+ * template <> FOLLY_ASSUME_RELOCATABLE(MyType)
  *
  * When using it with a template type, use it like this:
  *
  * // Make sure you're at namespace ::folly scope
- * template<class T1, class T2>
+ * template <class T1, class T2>
  * FOLLY_ASSUME_RELOCATABLE(MyType<T1, T2>)
  */
 #define FOLLY_ASSUME_RELOCATABLE(...) \
index 83ef6672eedf037a1d0d93efbca52a7b4e908e6d..7977a607c18e9d9202b6e0b86563ffc9926112fd 100644 (file)
@@ -68,10 +68,10 @@ class MMapAlloc {
   }
 };
 
-template<typename Allocator>
+template <typename Allocator>
 struct GivesZeroFilledMemory : public std::false_type {};
 
-template<>
+template <>
 struct GivesZeroFilledMemory<MMapAlloc> : public std::true_type{};
 
 }}
index 592e0b63f30532e910ea2b01b139b86000002ffd..dc0fa2b36669d5442c1d5a1f7736ad83129a6b91 100644 (file)
@@ -28,7 +28,7 @@
 namespace folly { namespace fileutil_detail {
 
 // Wrap call to f(args) in loop to retry on EINTR
-template<class F, class... Args>
+template <class F, class... Args>
 ssize_t wrapNoInt(F f, Args... args) {
   ssize_t r;
   do {
index 8755041657c3ad77c1dccb868ab6a266c2239298..1c5a540c1d63e01051cf00ffb655e7850560fe63 100644 (file)
@@ -144,20 +144,20 @@ struct EmulatedFutexAtomic : public std::atomic<T> {
 
 /* Available specializations, with definitions elsewhere */
 
-template<>
+template <>
 int Futex<std::atomic>::futexWake(int count, uint32_t wakeMask);
 
-template<>
+template <>
 FutexResult Futex<std::atomic>::futexWaitImpl(
       uint32_t expected,
       std::chrono::time_point<std::chrono::system_clock>* absSystemTime,
       std::chrono::time_point<std::chrono::steady_clock>* absSteadyTime,
       uint32_t waitMask);
 
-template<>
+template <>
 int Futex<EmulatedFutexAtomic>::futexWake(int count, uint32_t wakeMask);
 
-template<>
+template <>
 FutexResult Futex<EmulatedFutexAtomic>::futexWaitImpl(
       uint32_t expected,
       std::chrono::time_point<std::chrono::system_clock>* absSystemTime,
index 37c721383606fb5eeee08dd3db51222d3dc3abdb..c7a35297be2796da51f266d6c904c55e5bca17b5 100644 (file)
@@ -29,7 +29,7 @@ namespace folly {
 
 // gcc 4.7 doesn't do std::is_trivial correctly, override so we can use
 // AtomicStruct<duration>
-template<>
+template <>
 struct IsTriviallyCopyable<std::chrono::steady_clock::duration>
   : std::true_type {};
 
index 456daed4dc8e837e1d5f6b74c0ed8d0d3b301378..353d5a19200cd3d5cfa58b23784fc171b825a808 100644 (file)
@@ -68,7 +68,7 @@ namespace detail {
 /// cutoffs for different operations (read versus write, for example).
 /// To avoid contention, the spin cutoff is only updated when requested
 /// by the caller.
-template <template<typename> class Atom>
+template <template <typename> class Atom>
 struct TurnSequencer {
   explicit TurnSequencer(const uint32_t firstTurn = 0) noexcept
       : state_(encode(firstTurn << kTurnShift, 0))
index ee6a850eb485db355ff59eb2273281f7ff27f0c8..210dd0e335b9545506edb1879e63e667ecaf61fa 100644 (file)
@@ -29,8 +29,8 @@
 
 namespace std {
 
-template<>
-struct hash< ::folly::dynamic> {
+template <>
+struct hash<::folly::dynamic> {
   size_t operator()(::folly::dynamic const& d) const {
     return d.hash();
   }
@@ -100,7 +100,7 @@ namespace detail {
   // This helper is used in destroy() to be able to run destructors on
   // types like "int64_t" without a compiler error.
   struct Destroy {
-    template<class T> static void destroy(T* t) { t->~T(); }
+    template <class T> static void destroy(T* t) { t->~T(); }
   };
 
   /*
@@ -108,7 +108,7 @@ namespace detail {
    * numbers.  Just promotes to double when one of the arguments is
    * double, or throws if either is not a numeric type.
    */
-  template<template<class> class Op>
+  template <template <class> class Op>
   dynamic numericOp(dynamic const& a, dynamic const& b) {
     if (!a.isNumber() || !b.isNumber()) {
       throwTypeError_("numeric", a.type(), b.type());
@@ -339,7 +339,9 @@ struct dynamic::NumericTypeHelper<double> {
   using type = double;
 };
 
-template<class T, class NumericType /* = typename NumericTypeHelper<T>::type */>
+template <
+    class T,
+    class NumericType /* = typename NumericTypeHelper<T>::type */>
 dynamic::dynamic(T t) {
   type_ = TypeInfo<NumericType>::type;
   new (getAddress<NumericType>()) NumericType(NumericType(t));
@@ -484,18 +486,18 @@ inline StringPiece dynamic::stringPiece() const {
   return get<std::string>();
 }
 
-template<class T>
+template <class T>
 struct dynamic::CompareOp {
   static bool comp(T const& a, T const& b) { return a < b; }
 };
-template<>
+template <>
 struct dynamic::CompareOp<dynamic::ObjectImpl> {
   static bool comp(ObjectImpl const&, ObjectImpl const&) {
     // This code never executes; it is just here for the compiler.
     return false;
   }
 };
-template<>
+template <>
 struct dynamic::CompareOp<std::nullptr_t> {
   static bool comp(std::nullptr_t const&, std::nullptr_t const&) {
     return true;
@@ -560,19 +562,19 @@ inline dynamic&& dynamic::operator[](dynamic const& idx) && {
   return std::move((*this)[idx]);
 }
 
-template<class K, class V> inline dynamic& dynamic::setDefault(K&& k, V&& v) {
+template <class K, class V> inline dynamic& dynamic::setDefault(K&& k, V&& v) {
   auto& obj = get<ObjectImpl>();
   return obj.insert(std::make_pair(std::forward<K>(k),
                                    std::forward<V>(v))).first->second;
 }
 
-template<class K> inline dynamic& dynamic::setDefault(K&& k, dynamic&& v) {
+template <class K> inline dynamic& dynamic::setDefault(K&& k, dynamic&& v) {
   auto& obj = get<ObjectImpl>();
   return obj.insert(std::make_pair(std::forward<K>(k),
                                    std::move(v))).first->second;
 }
 
-template<class K> inline dynamic& dynamic::setDefault(K&& k, const dynamic& v) {
+template <class K> inline dynamic& dynamic::setDefault(K&& k, const dynamic& v) {
   auto& obj = get<ObjectImpl>();
   return obj.insert(std::make_pair(std::forward<K>(k), v)).first->second;
 }
@@ -607,7 +609,7 @@ inline dynamic::item_iterator dynamic::find(dynamic const& key) {
   return get<ObjectImpl>().find(key);
 }
 
-template<class K, class V> inline void dynamic::insert(K&& key, V&& val) {
+template <class K, class V> inline void dynamic::insert(K&& key, V&& val) {
   auto& obj = get<ObjectImpl>();
   auto rv = obj.insert({ std::forward<K>(key), nullptr });
   rv.first->second = std::forward<V>(val);
@@ -735,7 +737,7 @@ FOLLY_DYNAMIC_DEC_TYPEINFO(dynamic::ObjectImpl, "object",  dynamic::OBJECT)
 
 #undef FOLLY_DYNAMIC_DEC_TYPEINFO
 
-template<class T>
+template <class T>
 T dynamic::asImpl() const {
   switch (type()) {
   case INT64:    return to<T>(*get_nothrow<int64_t>());
@@ -749,7 +751,7 @@ T dynamic::asImpl() const {
 }
 
 // Return a T* to our type, or null if we're not that type.
-template<class T>
+template <class T>
 T* dynamic::get_nothrow() & noexcept {
   if (type_ != TypeInfo<T>::type) {
     return nullptr;
@@ -757,37 +759,37 @@ T* dynamic::get_nothrow() & noexcept {
   return getAddress<T>();
 }
 
-template<class T>
+template <class T>
 T const* dynamic::get_nothrow() const& noexcept {
   return const_cast<dynamic*>(this)->get_nothrow<T>();
 }
 
 // Return T* for where we can put a T, without type checking.  (Memory
 // might be uninitialized, even.)
-template<class T>
+template <class T>
 T* dynamic::getAddress() noexcept {
   return GetAddrImpl<T>::get(u_);
 }
 
-template<class T>
+template <class T>
 T const* dynamic::getAddress() const noexcept {
   return const_cast<dynamic*>(this)->getAddress<T>();
 }
 
-template<class T> struct dynamic::GetAddrImpl {};
-template<> struct dynamic::GetAddrImpl<std::nullptr_t> {
+template <class T> struct dynamic::GetAddrImpl {};
+template <> struct dynamic::GetAddrImpl<std::nullptr_t> {
   static std::nullptr_t* get(Data& d) noexcept { return &d.nul; }
 };
-template<> struct dynamic::GetAddrImpl<dynamic::Array> {
+template <> struct dynamic::GetAddrImpl<dynamic::Array> {
   static Array* get(Data& d) noexcept { return &d.array; }
 };
-template<> struct dynamic::GetAddrImpl<bool> {
+template <> struct dynamic::GetAddrImpl<bool> {
   static bool* get(Data& d) noexcept { return &d.boolean; }
 };
-template<> struct dynamic::GetAddrImpl<int64_t> {
+template <> struct dynamic::GetAddrImpl<int64_t> {
   static int64_t* get(Data& d) noexcept { return &d.integer; }
 };
-template<> struct dynamic::GetAddrImpl<double> {
+template <> struct dynamic::GetAddrImpl<double> {
   static double* get(Data& d) noexcept { return &d.doubl; }
 };
 template <>
@@ -796,7 +798,7 @@ struct dynamic::GetAddrImpl<std::string> {
     return &d.string;
   }
 };
-template<> struct dynamic::GetAddrImpl<dynamic::ObjectImpl> {
+template <> struct dynamic::GetAddrImpl<dynamic::ObjectImpl> {
   static_assert(sizeof(ObjectImpl) <= sizeof(Data::objectBuffer),
     "In your implementation, std::unordered_map<> apparently takes different"
     " amount of space depending on its template parameters.  This is "
@@ -808,7 +810,7 @@ template<> struct dynamic::GetAddrImpl<dynamic::ObjectImpl> {
   }
 };
 
-template<class T>
+template <class T>
 T& dynamic::get() {
   if (auto* p = get_nothrow<T>()) {
     return *p;
@@ -816,7 +818,7 @@ T& dynamic::get() {
   throwTypeError_(TypeInfo<T>::name, type());
 }
 
-template<class T>
+template <class T>
 T const& dynamic::get() const {
   return const_cast<dynamic*>(this)->get<T>();
 }
@@ -827,7 +829,7 @@ T const& dynamic::get() const {
  * Helper for implementing operator<<.  Throws if the type shouldn't
  * support it.
  */
-template<class T>
+template <class T>
 struct dynamic::PrintImpl {
   static void print(dynamic const&, std::ostream& out, T const& t) {
     out << t;
@@ -842,7 +844,7 @@ struct dynamic::PrintImpl<std::nullptr_t> {
     out << "null";
   }
 };
-template<>
+template <>
 struct dynamic::PrintImpl<dynamic::ObjectImpl> {
   static void print(dynamic const& d,
                     std::ostream& out,
@@ -850,7 +852,7 @@ struct dynamic::PrintImpl<dynamic::ObjectImpl> {
     d.print_as_pseudo_json(out);
   }
 };
-template<>
+template <>
 struct dynamic::PrintImpl<dynamic::Array> {
   static void print(dynamic const& d,
                     std::ostream& out,
index a62805090dd9058938830571b6112c77bf273624..b099df3e0afeda17fd88279a57d1ea6b85f023c7 100644 (file)
@@ -85,7 +85,7 @@ struct dynamic : private boost::operators<dynamic> {
     OBJECT,
     STRING,
   };
-  template<class T, class Enable = void> struct NumericTypeHelper;
+  template <class T, class Enable = void> struct NumericTypeHelper;
 
   /*
    * We support direct iteration of arrays, and indirect iteration of objects.
@@ -167,14 +167,14 @@ public:
    * Constructors for integral and float types.
    * Other types are SFINAEd out with NumericTypeHelper.
    */
-  template<class T, class NumericType = typename NumericTypeHelper<T>::type>
+  template <class T, class NumericType = typename NumericTypeHelper<T>::type>
   /* implicit */ dynamic(T t);
 
   /*
    * Create a dynamic that is an array of the values from the supplied
    * iterator range.
    */
-  template<class Iterator>
+  template <class Iterator>
   explicit dynamic(Iterator first, Iterator last);
 
   dynamic(dynamic const&);
@@ -417,15 +417,15 @@ public:
   dynamic getDefault(const dynamic& k, dynamic&& v) const&;
   dynamic getDefault(const dynamic& k, const dynamic& v = dynamic::object) &&;
   dynamic getDefault(const dynamic& k, dynamic&& v) &&;
-  template<class K, class V>
+  template <class K, class V>
   dynamic& setDefault(K&& k, V&& v);
   // MSVC 2015 Update 3 needs these extra overloads because if V were a
   // defaulted template parameter, it causes MSVC to consider v an rvalue
   // reference rather than a universal reference, resulting in it not being
   // able to find the correct overload to construct a dynamic with.
-  template<class K>
+  template <class K>
   dynamic& setDefault(K&& k, dynamic&& v);
-  template<class K>
+  template <class K>
   dynamic& setDefault(K&& k, const dynamic& v = dynamic::object);
 
   /*
@@ -445,7 +445,7 @@ public:
    *
    * Invalidates iterators.
    */
-  template<class K, class V> void insert(K&&, V&& val);
+  template <class K, class V> void insert(K&&, V&& val);
 
   /*
    * These functions merge two folly dynamic objects.
@@ -524,22 +524,22 @@ public:
 private:
   friend struct TypeError;
   struct ObjectImpl;
-  template<class T> struct TypeInfo;
-  template<class T> struct CompareOp;
-  template<class T> struct GetAddrImpl;
-  template<class T> struct PrintImpl;
+  template <class T> struct TypeInfo;
+  template <class T> struct CompareOp;
+  template <class T> struct GetAddrImpl;
+  template <class T> struct PrintImpl;
 
   explicit dynamic(Array&& array);
 
-  template<class T> T const& get() const;
-  template<class T> T&       get();
-  template<class T> T*       get_nothrow() & noexcept;
-  template<class T> T const* get_nothrow() const& noexcept;
-  template<class T> T*       get_nothrow() && noexcept = delete;
-  template<class T> T*       getAddress() noexcept;
-  template<class T> T const* getAddress() const noexcept;
+  template <class T> T const& get() const;
+  template <class T> T&       get();
+  template <class T> T*       get_nothrow() & noexcept;
+  template <class T> T const* get_nothrow() const& noexcept;
+  template <class T> T*       get_nothrow() && noexcept = delete;
+  template <class T> T*       getAddress() noexcept;
+  template <class T> T const* getAddress() const noexcept;
 
-  template<class T> T asImpl() const;
+  template <class T> T asImpl() const;
 
   static char const* typeName(Type);
   void destroy() noexcept;
index 6968c7fec64ea5e74f691d67dd9b58882b1a1795..f863c2d2c6a62413b693af1d0244a3d24e577a4d 100644 (file)
@@ -32,8 +32,7 @@
 namespace folly {
 namespace detail {
 
-template<typename T,
-         template<typename> class Atom>
+template <typename T, template <typename> class Atom>
 class RingBufferSlot;
 } // namespace detail
 
@@ -56,7 +55,7 @@ class RingBufferSlot;
 /// "future" can optionally block but reads from the "past" will always fail.
 ///
 
-template<typename T, template<typename> class Atom = std::atomic>
+template <typename T, template <typename> class Atom = std::atomic>
 class LockFreeRingBuffer: boost::noncopyable {
 
    static_assert(std::is_nothrow_default_constructible<T>::value,
@@ -180,7 +179,7 @@ private:
 }; // LockFreeRingBuffer
 
 namespace detail {
-template<typename T, template<typename> class Atom>
+template <typename T, template <typename> class Atom>
 class RingBufferSlot {
 public:
   explicit RingBufferSlot() noexcept
index 7f48b9cf59ae1a25ea2a49a08ff7079f6ad3bece..ee4a9475994dbcefcd28dbdb4175db2d906d637e 100644 (file)
@@ -92,7 +92,7 @@ TEST(LockFreeRingBuffer, readsCanBlock) {
 }
 
 // expose the cursor raw value via a wrapper type
-template<typename T, template<typename> class Atom>
+template <typename T, template <typename> class Atom>
 uint64_t value(const typename LockFreeRingBuffer<T, Atom>::Cursor& rbcursor) {
   typedef typename LockFreeRingBuffer<T,Atom>::Cursor RBCursor;
 
@@ -105,7 +105,7 @@ uint64_t value(const typename LockFreeRingBuffer<T, Atom>::Cursor& rbcursor) {
   return ExposedCursor(rbcursor).value();
 }
 
-template<template<typename> class Atom>
+template <template <typename> class Atom>
 void runReader(
     LockFreeRingBuffer<int, Atom>& rb, std::atomic<int32_t>& writes
 ) {
@@ -115,7 +115,7 @@ void runReader(
   }
 }
 
-template<template<typename> class Atom>
+template <template <typename> class Atom>
 void runWritesNeverFail(
     int capacity, int writes, int writers
 ) {
index a2e2dcc39737d83aef9730cd95391ff8715ddba0..6012fec0d940412371563b261dcde75b7d1ccf54 100644 (file)
 #include <folly/experimental/RCURefCount.h>
 #include <folly/portability/GFlags.h>
 
-template <template<typename> class MainPtr,
-          template<typename> class WeakPtr,
-          size_t threadCount>
+template <
+    template <typename> class MainPtr,
+    template <typename> class WeakPtr,
+    size_t threadCount>
 void benchmark(size_t n) {
   MainPtr<int> mainPtr(std::make_unique<int>(42));
 
index 3eb9056e509eaceb6fef70500582cb263acb2409..8d1fd98f04940bf3de21bc2b199e62b9fa031907 100644 (file)
@@ -46,7 +46,7 @@ template <class...> struct CollectAllVariadicContext;
 template <class...> struct CollectVariadicContext;
 template <class> struct CollectContext;
 
-template<typename F, typename... Args>
+template <typename F, typename... Args>
 using resultOf = decltype(std::declval<F>()(std::declval<Args>()...));
 
 template <typename...>
@@ -67,14 +67,13 @@ struct argResult {
   using Result = resultOf<F, Args...>;
 };
 
-template<typename F, typename... Args>
+template <typename F, typename... Args>
 struct callableWith {
-    template<typename T,
-             typename = detail::resultOf<T, Args...>>
+    template <typename T, typename = detail::resultOf<T, Args...>>
     static constexpr std::true_type
     check(std::nullptr_t) { return std::true_type{}; }
 
-    template<typename>
+    template <typename>
     static constexpr std::false_type
     check(...) { return std::false_type{}; }
 
@@ -82,7 +81,7 @@ struct callableWith {
     static constexpr bool value = type::value;
 };
 
-template<typename T, typename F>
+template <typename T, typename F>
 struct callableResult {
   typedef typename std::conditional<
     callableWith<F>::value,
index 70b1685e62cc345e07b83ce965ba4dc4165e08df..15afd34371eef79ba2b804bfe91919b9f847e7d0 100644 (file)
@@ -77,7 +77,7 @@ enum class State : uint8_t {
 /// first blush, but it's the same principle. In general, as long as the user
 /// doesn't access a Future or Promise object from more than one thread at a
 /// time there won't be any problems.
-template<typename T>
+template <typename T>
 class Core final {
   static_assert(!std::is_void<T>::value,
                 "void futures are not supported. Use Unit instead.");
index c71fbe02bb3fd53cb757f81c726541b92ec07239..4366d5915f676d89cc70e0f061b2ca634c6b60aa 100644 (file)
@@ -332,7 +332,7 @@ using MaybeTryArg = typename std::conditional<
     Try<ItT>,
     ItT>::type;
 
-template<typename F, typename T, typename Arg>
+template <typename F, typename T, typename Arg>
 using isFutureResult = isFuture<typename std::result_of<F(T&&, Arg&&)>::type>;
 
 /** repeatedly calls func on every result, e.g.
index 06dc4196cb00cbf036f88edd230ad49b388afb8c..65de4b78be89a54e5c1a7369f03fa909134f3a74 100644 (file)
@@ -23,7 +23,7 @@ namespace folly {
  * Convenience class so that AsyncTransportWrapper can be decorated without
  * having to redefine every single method.
  */
-template<class T>
+template <class T>
 class DecoratedAsyncTransportWrapper : public folly::AsyncTransportWrapper {
  public:
   explicit DecoratedAsyncTransportWrapper(typename T::UniquePtr transport):
index b7d106a712bebed19f879788280f8f537c8d4b4d..703e6849a81d9019c5839257c7a19904d893f2f1 100644 (file)
@@ -70,7 +70,7 @@ class EventBaseLocalBase : public EventBaseLocalBaseBase, boost::noncopyable {
  * by the get() method after set/erase is called.  If shared ownership is
  * needed, use a EventBaseLocal<shared_ptr<...>>.
  */
-template<typename T>
+template <typename T>
 class EventBaseLocal : public detail::EventBaseLocalBase {
  public:
   EventBaseLocal(): EventBaseLocalBase() {}
index cfcafd838923e955d8986e8c85d6b32bf0129c12..31de20155fc2d25a70dcf3a746b96d79c7eabb85 100644 (file)
@@ -102,7 +102,7 @@ class EventBaseManager {
    * this moment in time.  Locks a mutex so that these EventBase set cannot
    * be changed, and also the caller can rely on no instances being destructed.
    */
-  template<typename FunctionType>
+  template <typename FunctionType>
   void withEventBaseSet(const FunctionType& runnable) {
     // grab the mutex for the caller
     std::lock_guard<std::mutex> g(*&eventBaseSetMutex_);
index 0b3ae9e48f31bb86b2336ba4901d028bbe2a91ab..e57ef66172077cb08fe7196652f7a1ad4c7f7f16 100644 (file)
@@ -65,7 +65,7 @@ namespace folly {
  * spinning trying to move a message off the queue and failing, and then
  * retrying.
  */
-template<typename MessageT>
+template <typename MessageT>
 class NotificationQueue {
  public:
   /**
@@ -396,7 +396,7 @@ class NotificationQueue {
   /**
    * Put several messages on the queue.
    */
-  template<typename InputIteratorT>
+  template <typename InputIteratorT>
   void putMessages(InputIteratorT first, InputIteratorT last) {
     typedef typename std::iterator_traits<InputIteratorT>::iterator_category
       IterCategory;
@@ -611,7 +611,7 @@ class NotificationQueue {
     return true;
   }
 
-  template<typename InputIteratorT>
+  template <typename InputIteratorT>
   void putMessagesImpl(InputIteratorT first, InputIteratorT last,
                        std::input_iterator_tag) {
     checkPid();
@@ -646,7 +646,7 @@ class NotificationQueue {
   bool draining_{false};
 };
 
-template<typename MessageT>
+template <typename MessageT>
 void NotificationQueue<MessageT>::Consumer::destroy() {
   // If we are in the middle of a call to handlerReady(), destroyedFlagPtr_
   // will be non-nullptr.  Mark the value that it points to, so that
@@ -659,13 +659,13 @@ void NotificationQueue<MessageT>::Consumer::destroy() {
   DelayedDestruction::destroy();
 }
 
-template<typename MessageT>
+template <typename MessageT>
 void NotificationQueue<MessageT>::Consumer::handlerReady(uint16_t /*events*/)
     noexcept {
   consumeMessages(false);
 }
 
-template<typename MessageT>
+template <typename MessageT>
 void NotificationQueue<MessageT>::Consumer::consumeMessages(
     bool isDrain, size_t* numConsumed) noexcept {
   DestructorGuard dg(this);
@@ -775,7 +775,7 @@ void NotificationQueue<MessageT>::Consumer::consumeMessages(
   }
 }
 
-template<typename MessageT>
+template <typename MessageT>
 void NotificationQueue<MessageT>::Consumer::init(
     EventBase* eventBase,
     NotificationQueue* queue) {
@@ -801,7 +801,7 @@ void NotificationQueue<MessageT>::Consumer::init(
   }
 }
 
-template<typename MessageT>
+template <typename MessageT>
 void NotificationQueue<MessageT>::Consumer::stopConsuming() {
   if (queue_ == nullptr) {
     assert(!isHandlerRegistered());
@@ -820,7 +820,7 @@ void NotificationQueue<MessageT>::Consumer::stopConsuming() {
   queue_ = nullptr;
 }
 
-template<typename MessageT>
+template <typename MessageT>
 bool NotificationQueue<MessageT>::Consumer::consumeUntilDrained(
     size_t* numConsumed) noexcept {
   DestructorGuard dg(this);
index f944d6062f92faf1014adc29e5d711799d0242b7..cc8e441967af028ee45a2b67e5e08c52a36ea9dd 100644 (file)
@@ -40,7 +40,7 @@ namespace folly {
  * destroy a UndelayedDestruction object while it has a non-zero destructor
  * guard count will abort the program.
  */
-template<typename TDD>
+template <typename TDD>
 class UndelayedDestruction : public TDD {
  public:
   // We could just use constructor inheritance, but not all compilers
@@ -53,7 +53,7 @@ class UndelayedDestruction : public TDD {
   // gcc code it looks like it has been fixed to return false.  (The language
   // in the standard seems to indicate that returning false is the correct
   // behavior for non-destructible types, which is unfortunate.)
-  template<typename ...Args>
+  template <typename... Args>
   explicit UndelayedDestruction(Args&& ...args)
     : TDD(std::forward<Args>(args)...) {
   }
index ee56f0b1ea40634802e4720d7bdba94a10863f0a..07db1c330e9249a7864eabcc2204ecdc4269d549 100644 (file)
@@ -217,7 +217,7 @@ struct Input {
 
   // Parse ahead for as long as the supplied predicate is satisfied,
   // returning a range of what was skipped.
-  template<class Predicate>
+  template <class Predicate>
   StringPiece skipWhile(const Predicate& p) {
     std::size_t skipped = 0;
     for (; skipped < range_.size(); ++skipped) {
@@ -273,7 +273,7 @@ struct Input {
     storeCurrent();
   }
 
-  template<class T>
+  template <class T>
   T extract() {
     try {
       return to<T>(&range_);
index 741aaf3a896c30965ca4e085e835b8e6121377fd..71893a3c387780186455b5a8aa351aacf3dcc6a9 100644 (file)
@@ -78,7 +78,7 @@ struct NoHeap;
 
 //////////////////////////////////////////////////////////////////////
 
-template<class T, std::size_t M, class A, class B, class C>
+template <class T, std::size_t M, class A, class B, class C>
 class small_vector;
 
 //////////////////////////////////////////////////////////////////////
@@ -89,7 +89,7 @@ namespace detail {
    * Move a range to a range of uninitialized memory.  Assumes the
    * ranges don't overlap.
    */
-  template<class T>
+  template <class T>
   typename std::enable_if<
     !FOLLY_IS_TRIVIALLY_COPYABLE(T)
   >::type
@@ -113,7 +113,7 @@ namespace detail {
   }
 
   // Specialization for trivially copyable types.
-  template<class T>
+  template <class T>
   typename std::enable_if<
     FOLLY_IS_TRIVIALLY_COPYABLE(T)
   >::type
@@ -163,7 +163,7 @@ namespace detail {
    * std::move_backward because move_backward only works if all the
    * memory is initialized to type T already.
    */
-  template<class T>
+  template <class T>
   typename std::enable_if<
     !FOLLY_IS_TRIVIALLY_COPYABLE(T)
   >::type
@@ -202,7 +202,7 @@ namespace detail {
   // Specialization for trivially copyable types.  The call to
   // std::move_backward here will just turn into a memmove.  (TODO:
   // change to std::is_trivially_copyable when that works.)
-  template<class T>
+  template <class T>
   typename std::enable_if<
     FOLLY_IS_TRIVIALLY_COPYABLE(T)
   >::type
@@ -214,7 +214,7 @@ namespace detail {
    * Populate a region of memory using `op' to construct elements.  If
    * anything throws, undo what we did.
    */
-  template<class T, class Function>
+  template <class T, class Function>
   void populateMemForward(T* mem, std::size_t n, Function const& op) {
     std::size_t idx = 0;
     try {
@@ -230,7 +230,7 @@ namespace detail {
     }
   }
 
-  template<class SizeType, bool ShouldUseHeap>
+  template <class SizeType, bool ShouldUseHeap>
   struct IntegralSizePolicy {
     typedef SizeType InternalSizeType;
 
@@ -289,11 +289,12 @@ namespace detail {
    * Apologies for all the black magic.
    */
   namespace mpl = boost::mpl;
-  template<class Value,
-           std::size_t RequestedMaxInline,
-           class InPolicyA,
-           class InPolicyB,
-           class InPolicyC>
+  template <
+      class Value,
+      std::size_t RequestedMaxInline,
+      class InPolicyA,
+      class InPolicyB,
+      class InPolicyC>
   struct small_vector_base {
     typedef mpl::vector<InPolicyA,InPolicyB,InPolicyC> PolicyList;
 
@@ -364,11 +365,12 @@ namespace detail {
 
 //////////////////////////////////////////////////////////////////////
 FOLLY_PACK_PUSH
-template<class Value,
-         std::size_t RequestedMaxInline    = 1,
-         class PolicyA                     = void,
-         class PolicyB                     = void,
-         class PolicyC                     = void>
+template <
+    class Value,
+    std::size_t RequestedMaxInline = 1,
+    class PolicyA = void,
+    class PolicyB = void,
+    class PolicyC = void>
 class small_vector
   : public detail::small_vector_base<
       Value,RequestedMaxInline,PolicyA,PolicyB,PolicyC
@@ -439,7 +441,7 @@ class small_vector
     doConstruct(n, [&](void* p) { new (p) value_type(t); });
   }
 
-  template<class Arg>
+  template <class Arg>
   explicit small_vector(Arg arg1, Arg arg2)  {
     // Forward using std::is_arithmetic to get to the proper
     // implementation; this disambiguates between the iterators and
@@ -626,7 +628,7 @@ class small_vector
     return this->isExtern() ? u.heap() : u.buffer();
   }
 
-  template<class ...Args>
+  template <class... Args>
   iterator emplace(const_iterator p, Args&&... args) {
     if (p == cend()) {
       emplace_back(std::forward<Args>(args)...);
@@ -747,7 +749,7 @@ class small_vector
     return begin() + offset;
   }
 
-  template<class Arg>
+  template <class Arg>
   iterator insert(const_iterator p, Arg arg1, Arg arg2) {
     // Forward using std::is_arithmetic to get to the proper
     // implementation; this disambiguates between the iterators and
@@ -780,7 +782,7 @@ class small_vector
     erase(begin(), end());
   }
 
-  template<class Arg>
+  template <class Arg>
   void assign(Arg first, Arg last) {
     clear();
     insert(end(), first, last);
@@ -832,7 +834,7 @@ private:
 
   // The std::false_type argument is part of disambiguating the
   // iterator insert functions from integral types (see insert().)
-  template<class It>
+  template <class It>
   iterator insertImpl(iterator pos, It first, It last, std::false_type) {
     typedef typename std::iterator_traits<It>::iterator_category categ;
     if (std::is_same<categ,std::input_iterator_tag>::value) {
@@ -865,7 +867,7 @@ private:
   // The std::false_type argument came from std::is_arithmetic as part
   // of disambiguating an overload (see the comment in the
   // constructor).
-  template<class It>
+  template <class It>
   void constructImpl(It first, It last, std::false_type) {
     typedef typename std::iterator_traits<It>::iterator_category categ;
     if (std::is_same<categ,std::input_iterator_tag>::value) {
@@ -1126,7 +1128,7 @@ FOLLY_PACK_POP
 
 // Basic guarantee only, or provides the nothrow guarantee iff T has a
 // nothrow move or copy constructor.
-template<class T, std::size_t MaxInline, class A, class B, class C>
+template <class T, std::size_t MaxInline, class A, class B, class C>
 void swap(small_vector<T,MaxInline,A,B,C>& a,
           small_vector<T,MaxInline,A,B,C>& b) {
   a.swap(b);
index 41d26fc033dcb769fa2fabc954ec9bb2256a061d..6d988efd47c29c9494c746070b1b881d52dab42f 100644 (file)
@@ -34,7 +34,7 @@
  * example growth policy that grows one element at a time:
  *
  *    struct OneAtATimePolicy {
- *      template<class Container>
+ *      template <class Container>
  *      void increase_capacity(Container& c) {
  *        if (c.size() == c.capacity()) {
  *          c.reserve(c.size() + 1);
@@ -79,9 +79,9 @@ namespace detail {
   // This wrapper goes around a GrowthPolicy and provides iterator
   // preservation semantics, but only if the growth policy is not the
   // default (i.e. nothing).
-  template<class Policy>
+  template <class Policy>
   struct growth_policy_wrapper : private Policy {
-    template<class Container, class Iterator>
+    template <class Container, class Iterator>
     Iterator increase_capacity(Container& c, Iterator desired_insertion)
     {
       typedef typename Container::difference_type diff_t;
@@ -90,9 +90,9 @@ namespace detail {
       return c.begin() + d;
     }
   };
-  template<>
+  template <>
   struct growth_policy_wrapper<void> {
-    template<class Container, class Iterator>
+    template <class Container, class Iterator>
     Iterator increase_capacity(Container&, Iterator it) {
       return it;
     }
@@ -104,7 +104,7 @@ namespace detail {
    * (i.e. unless they are InputIterators).  Otherwise this returns
    * -1.
    */
-  template<class Iterator>
+  template <class Iterator>
   int distance_if_multipass(Iterator first, Iterator last) {
     typedef typename std::iterator_traits<Iterator>::iterator_category categ;
     if (std::is_same<categ,std::input_iterator_tag>::value)
@@ -112,7 +112,7 @@ namespace detail {
     return std::distance(first, last);
   }
 
-  template<class OurContainer, class Vector, class GrowthPolicy>
+  template <class OurContainer, class Vector, class GrowthPolicy>
   typename OurContainer::iterator
   insert_with_hint(OurContainer& sorted,
                    Vector& cont,
@@ -198,10 +198,11 @@ namespace detail {
  * @author Akhil Wable    <akhil@fb.com>
  * @author Jordan DeLong  <delong.j@fb.com>
  */
-template<class T,
-         class Compare      = std::less<T>,
-         class Allocator    = std::allocator<T>,
-         class GrowthPolicy = void>
+template <
+    class T,
+    class Compare = std::less<T>,
+    class Allocator = std::allocator<T>,
+    class GrowthPolicy = void>
 class sorted_vector_set
   : boost::totally_ordered1<
       sorted_vector_set<T,Compare,Allocator,GrowthPolicy>
@@ -238,7 +239,7 @@ public:
     : m_(comp, alloc)
   {}
 
-  template<class InputIterator>
+  template <class InputIterator>
   explicit sorted_vector_set(
       InputIterator first,
       InputIterator last,
@@ -320,7 +321,7 @@ public:
       get_growth_policy());
   }
 
-  template<class InputIterator>
+  template <class InputIterator>
   void insert(InputIterator first, InputIterator last) {
     detail::bulk_insert(*this, m_.cont_, first, last);
   }
@@ -424,7 +425,7 @@ private:
 };
 
 // Swap function that can be found using ADL.
-template<class T, class C, class A, class G>
+template <class T, class C, class A, class G>
 inline void swap(sorted_vector_set<T,C,A,G>& a,
                  sorted_vector_set<T,C,A,G>& b) {
   return a.swap(b);
@@ -447,11 +448,12 @@ inline void swap(sorted_vector_set<T,C,A,G>& a,
  * @author Akhil Wable    <akhil@fb.com>
  * @author Jordan DeLong  <delong.j@fb.com>
  */
-template<class Key,
-         class Value,
-         class Compare        = std::less<Key>,
-         class Allocator      = std::allocator<std::pair<Key,Value> >,
-         class GrowthPolicy   = void>
+template <
+    class Key,
+    class Value,
+    class Compare = std::less<Key>,
+    class Allocator = std::allocator<std::pair<Key, Value>>,
+    class GrowthPolicy = void>
 class sorted_vector_map
   : boost::totally_ordered1<
       sorted_vector_map<Key,Value,Compare,Allocator,GrowthPolicy>
@@ -493,7 +495,7 @@ public:
     : m_(value_compare(comp), alloc)
   {}
 
-  template<class InputIterator>
+  template <class InputIterator>
   explicit sorted_vector_map(
       InputIterator first,
       InputIterator last,
@@ -573,7 +575,7 @@ public:
       get_growth_policy());
   }
 
-  template<class InputIterator>
+  template <class InputIterator>
   void insert(InputIterator first, InputIterator last) {
     detail::bulk_insert(*this, m_.cont_, first, last);
   }
@@ -717,7 +719,7 @@ private:
 };
 
 // Swap function that can be found using ADL.
-template<class K, class V, class C, class A, class G>
+template <class K, class V, class C, class A, class G>
 inline void swap(sorted_vector_map<K,V,C,A,G>& a,
                  sorted_vector_map<K,V,C,A,G>& b) {
   return a.swap(b);
index d18e240828fe7250d481fd7464ccb86e15f58618..fa9a575bd4723169219fd129b7acccd06a786e43 100644 (file)
@@ -81,7 +81,7 @@ struct GuardObjBase {
 };
 typedef GuardObjBase const& Guard;
 
-template<class F, class Tuple>
+template <class F, class Tuple>
 struct GuardObj : GuardObjBase {
   explicit GuardObj(F&& f, Tuple&& args)
     : f_(std::forward<F>(f))
@@ -105,7 +105,7 @@ private:
   Tuple args_;
 };
 
-template<class F, class ...Args>
+template <class F, class... Args>
 GuardObj<typename std::decay<F>::type,std::tuple<Args...>>
 guard(F&& f, Args&&... args) {
   return GuardObj<typename std::decay<F>::type,std::tuple<Args...>>(
index b1f9142e89e101a1648182d65e18299dcbd161c8..4ab51b782a641f95ddf786296b65b7de41a8711e 100644 (file)
@@ -89,7 +89,7 @@ struct AsciiCaseInsensitiveLegacy {
   }
 };
 
-template<typename Cmp>
+template <typename Cmp>
 inline void test_operator_on_search(int iters) {
   Cmp cmp;
   int dummy = 0;
index 3e9dacb2dead2bc3413e5fa136eb676643ea4c2d..d2bda88b8263e14becf8db994222838bf597d287 100644 (file)
@@ -83,7 +83,7 @@ class MmapAllocator {
   }
 };
 
-template<class KeyT, class ValueT>
+template <class KeyT, class ValueT>
 pair<KeyT,ValueT> createEntry(int i) {
   return pair<KeyT,ValueT>(to<KeyT>(folly::hash::jenkins_rev_mix32(i) % 1000),
                            to<ValueT>(i + 3));
@@ -140,7 +140,9 @@ void testMap() {
   }
 }
 
-template<class KeyT, class ValueT,
+template <
+    class KeyT,
+    class ValueT,
     class Allocator = std::allocator<char>,
     class ProbeFcn = AtomicHashArrayLinearProbeFcn>
 void testNoncopyableMap() {
index 957b6063330dfb102e09cfdaa98c2004486e4edc..8b50e0c6d614f3e1beae2069c1c58d53f6bd51b0 100644 (file)
@@ -28,7 +28,7 @@
 using namespace folly;
 using namespace folly::test;
 
-template<class T>
+template <class T>
 struct non_atomic {
   T value;
 
index 77e77d423e25c86ee7d6494ac142fe947e477dfe..0f189590d92e6a20e0b70af94cc7fa64b6840e91 100644 (file)
@@ -782,7 +782,7 @@ TEST(Conv, IntegralToBool) {
   EXPECT_TRUE(to<bool>(42ul));
 }
 
-template<typename Src>
+template <typename Src>
 void testStr2Bool() {
   EXPECT_FALSE(to<bool>(Src("0")));
   EXPECT_FALSE(to<bool>(Src("  000  ")));
index ca327cdf0d5917b07979d110a44354e401fe03bb..504c1c51d0bea37b6fa7256c2f0e744a58cc666f 100644 (file)
@@ -69,13 +69,13 @@ std::list<char> RandomList(unsigned int maxSize) {
   return lst;
 }
 
-template<class T> T randomObject();
+template <class T> T randomObject();
 
-template<> int randomObject<int>() {
+template <> int randomObject<int>() {
   return random(0, 1024);
 }
 
-template<> folly::fbstring randomObject<folly::fbstring>() {
+template <> folly::fbstring randomObject<folly::fbstring>() {
   folly::fbstring result;
   randomString(&result);
   return result;
index 604cd05a9648b81b98a1f7621c5064ca86123f28..472ce8d72f6779d90feff86efa4f56056db817af 100644 (file)
@@ -62,9 +62,9 @@ void Num2String(String& str, Integral /* n */) {
   str.resize(strlen(str.c_str()));
 }
 
-template<class T> T randomObject();
+template <class T> T randomObject();
 
-template<> int randomObject<int>() {
+template <> int randomObject<int>() {
   return random(0, 1024);
 }
 }
index db57ef9ee6f594258bebb65f66771429a445422d..a4048f400a1066880334ae311227474130cd96db 100644 (file)
@@ -34,13 +34,13 @@ using namespace std::chrono;
 
 typedef DeterministicSchedule DSched;
 
-template <template<typename> class Atom>
+template <template <typename> class Atom>
 void run_basic_thread(
     Futex<Atom>& f) {
   EXPECT_TRUE(f.futexWait(0));
 }
 
-template <template<typename> class Atom>
+template <template <typename> class Atom>
 void run_basic_tests() {
   Futex<Atom> f(0);
 
@@ -56,7 +56,7 @@ void run_basic_tests() {
   DSched::join(thr);
 }
 
-template <template<typename> class Atom, typename Clock, typename Duration>
+template <template <typename> class Atom, typename Clock, typename Duration>
 void liveClockWaitUntilTests() {
   Futex<Atom> f(0);
 
@@ -113,7 +113,7 @@ void deterministicAtomicWaitUntilTests() {
   EXPECT_TRUE(res == FutexResult::TIMEDOUT || res == FutexResult::INTERRUPTED);
 }
 
-template<template<typename> class Atom>
+template <template <typename> class Atom>
 void run_wait_until_tests() {
   liveClockWaitUntilTests<Atom, system_clock, system_clock::duration>();
   liveClockWaitUntilTests<Atom, steady_clock, steady_clock::duration>();
index f2467eda65b0205bc98e7d7df8e26e2a8628c606..50d1de5dc1de2e33cf0f76fdafe4d7e7609eb032 100644 (file)
@@ -46,7 +46,7 @@ using std::vector;
 
 typedef DeterministicSchedule DSched;
 
-template <template<typename> class Atom>
+template <template <typename> class Atom>
 void run_mt_sequencer_thread(
     int numThreads,
     int numOps,
@@ -63,7 +63,7 @@ void run_mt_sequencer_thread(
   }
 }
 
-template <template<typename> class Atom>
+template <template <typename> class Atom>
 void run_mt_sequencer_test(int numThreads, int numOps, uint32_t init) {
   TurnSequencer<Atom> seq(init);
   Atom<uint32_t> spinThreshold(0);
@@ -235,7 +235,7 @@ TEST(MPMCQueue, enq_capacity_test) {
   }
 }
 
-template <template<typename> class Atom, bool Dynamic = false>
+template <template <typename> class Atom, bool Dynamic = false>
 void runTryEnqDeqThread(
     int numThreads,
     int n, /*numOps*/
@@ -262,7 +262,7 @@ void runTryEnqDeqThread(
   sum += threadSum;
 }
 
-template <template<typename> class Atom, bool Dynamic = false>
+template <template <typename> class Atom, bool Dynamic = false>
 void runTryEnqDeqTest(int numThreads, int numOps) {
   // write and read aren't linearizable, so we don't have
   // hard guarantees on their individual behavior.  We can still test
@@ -738,7 +738,7 @@ uint64_t runNeverFailTest(int numThreads, int numOps) {
   return nowMicro() - beginMicro;
 }
 
-template <template<typename> class Atom, bool Dynamic = false>
+template <template <typename> class Atom, bool Dynamic = false>
 void runMtNeverFail(std::vector<int>& nts, int n) {
   for (int nt : nts) {
     uint64_t elapsed = runNeverFailTest<Atom, Dynamic>(nt, n);
@@ -764,7 +764,7 @@ TEST(MPMCQueue, mt_never_fail_emulated_futex) {
   runMtNeverFail<EmulatedFutexAtomic>(nts, n);
 }
 
-template<bool Dynamic = false>
+template <bool Dynamic = false>
 void runMtNeverFailDeterministic(std::vector<int>& nts, int n, long seed) {
   LOG(INFO) << "using seed " << seed;
   for (int nt : nts) {
index 775d0428dcfa90dda8e26766f7ed8dd39325e08f..bd9a9ecf6a71c5dc1400a6e7de0e3f92e81fc7c5 100644 (file)
@@ -93,7 +93,7 @@ namespace folly { namespace detail {
 /// method signatures differ from the real Futex because we have elided
 /// unused default params and collapsed templated methods into the
 /// used type
-template<>
+template <>
 struct Futex<MockAtom> {
   MOCK_METHOD2(futexWait, bool(uint32_t, uint32_t));
   MOCK_METHOD3(futexWaitUntil,
index d075eeabd6a6cb4d342eb2a144cddc8fde75c317..df1e5c4aecfcaac97762049b863e5a953d1cf270 100644 (file)
@@ -33,7 +33,7 @@ using std::shared_ptr;
 
 namespace folly {
 
-template<class V>
+template <class V>
 std::ostream& operator<<(std::ostream& os, const Optional<V>& v) {
   if (v) {
     os << "Optional(" << v.value() << ')';
index 5dd6aa7180cd00be4b41b1d0c7faadf155dc2bfe..f604214453f9a8ded6bb8e6f5134497d5581bf9c 100644 (file)
@@ -66,7 +66,7 @@ TEST(PackedSyncPtr, Basic) {
 }
 
 // Here we use the PackedSyncPtr to lock the whole SyncVec (base, *base, and sz)
-template<typename T>
+template <typename T>
 struct SyncVec {
   PackedSyncPtr<T> base;
   SyncVec() { base.init(); }
index 0ee9b88429e7f54c9a5d0f65ff9cd5e267dea098..35a4942fbb1fb9a1489aaff36d861a691184bc46 100644 (file)
@@ -40,7 +40,7 @@ typedef ProducerConsumerQueue<ThroughputType> ThroughputQueueType;
 typedef unsigned long LatencyType;
 typedef ProducerConsumerQueue<LatencyType> LatencyQueueType;
 
-template<class QueueType>
+template <class QueueType>
 struct ThroughputTest {
   explicit ThroughputTest(size_t size, int iters, int cpu0, int cpu1)
   : queue_(size),
@@ -86,7 +86,7 @@ struct ThroughputTest {
   int cpu1_;
 };
 
-template<class QueueType>
+template <class QueueType>
 struct LatencyTest {
   explicit LatencyTest(size_t size, int iters, int cpu0, int cpu1)
   : queue_(size),
index 1742815629ad11a8776692b5576e51ce01ca36c9..a30b6e2f134436f222f8b30186b00a2fbf8c1c52 100644 (file)
 
 namespace {
 
-template<class T> struct TestTraits {
+template <class T> struct TestTraits {
   T limit() const { return 1 << 24; }
   T generate() const { return rand() % 26; }
 };
 
-template<> struct TestTraits<std::string> {
+template <> struct TestTraits<std::string> {
   unsigned int limit() const { return 1 << 22; }
   std::string generate() const { return std::string(12, ' '); }
 };
 
-template<class QueueType, size_t Size, bool Pop = false>
+template <class QueueType, size_t Size, bool Pop = false>
 struct PerfTest {
   typedef typename QueueType::value_type T;
 
@@ -92,13 +92,13 @@ struct PerfTest {
   TestTraits<T> traits_;
 };
 
-template<class TestType> void doTest(const char* name) {
+template <class TestType> void doTest(const char* name) {
   LOG(INFO) << "  testing: " << name;
   std::unique_ptr<TestType> const t(new TestType());
   (*t)();
 }
 
-template<class T, bool Pop = false>
+template <class T, bool Pop = false>
 void perfTestType(const char* type) {
   const size_t size = 0xfffe;
 
@@ -107,7 +107,7 @@ void perfTestType(const char* type) {
     "ProducerConsumerQueue");
 }
 
-template<class QueueType, size_t Size, bool Pop>
+template <class QueueType, size_t Size, bool Pop>
 struct CorrectnessTest {
   typedef typename QueueType::value_type T;
 
@@ -197,7 +197,7 @@ struct CorrectnessTest {
   std::atomic<bool> done_;
 };
 
-template<class T, bool Pop = false>
+template <class T, bool Pop = false>
 void correctnessTestType(const std::string& type) {
   LOG(INFO) << "Type: " << type;
   doTest<CorrectnessTest<folly::ProducerConsumerQueue<T>,0xfffe,Pop> >(
index 8323d08d05ec75072ae35bf0a1afb020bec50671..fb61572feecff47d0a023d0569d67e5d8a30233d 100644 (file)
@@ -38,7 +38,7 @@ static const int kMaxReaders = 50;
 static std::atomic<bool> stopThread;
 using namespace folly;
 
-template<typename RWSpinLockT> struct RWSpinLockTest: public testing::Test {
+template <typename RWSpinLockT> struct RWSpinLockTest: public testing::Test {
   typedef RWSpinLockT RWSpinLockType;
 };
 
@@ -53,7 +53,7 @@ typedef testing::Types<RWSpinLock
 
 TYPED_TEST_CASE(RWSpinLockTest, Implementations);
 
-template<typename RWSpinLockType>
+template <typename RWSpinLockType>
 static void run(RWSpinLockType* lock) {
   int64_t reads = 0;
   int64_t writes = 0;
index 8070b80110b6eb192075d639527359e897c14780..d9658a702c81dee0daef5be4140d17ec8cbf0da3 100644 (file)
@@ -1091,7 +1091,7 @@ constexpr T* dataPtr(T (&arr)[N]) noexcept {
   return &arr[0];
 }
 
-template<class C>
+template <class C>
 void testRangeFunc(C&& x, size_t n) {
   const auto& cx = x;
   // type, conversion checks
index 630c7c6e5a688540d882fd4417414255cf40d1f3..bee14facf2eb0b71882b6398a4c1a35b44e855f9 100644 (file)
@@ -83,7 +83,7 @@ void splock_test() {
 }
 
 #ifdef FOLLY_PICO_SPIN_LOCK_H_
-template<class T> struct PslTest {
+template <class T> struct PslTest {
   PicoSpinLock<T> lock;
 
   PslTest() { lock.init(); }
@@ -102,7 +102,7 @@ template<class T> struct PslTest {
   }
 };
 
-template<class T>
+template <class T>
 void doPslTest() {
   PslTest<T> testObj;
 
index 9446a4aaeff70ce6b8cb158e9b4127ba97ffa5f4..e95a6f70d2d43e43901c7253cdbc0915f25eb6eb 100644 (file)
@@ -493,7 +493,7 @@ TEST(System, errnoStr) {
 
 namespace {
 
-template<template<class,class> class VectorType>
+template <template <class, class> class VectorType>
 void splitTest() {
   VectorType<string,std::allocator<string> > parts;
 
@@ -642,7 +642,7 @@ void splitTest() {
   EXPECT_EQ(parts[3], "");
 }
 
-template<template<class,class> class VectorType>
+template <template <class, class> class VectorType>
 void piecesTest() {
   VectorType<StringPiece,std::allocator<StringPiece> > pieces;
   VectorType<StringPiece,std::allocator<StringPiece> > pieces2;
index 7065695406eade9deac6fd2107b3fa51872fdf1a..43622cd3c8c63f738cdc9955e6a7dedc72ef0ba0 100644 (file)
@@ -183,7 +183,7 @@ boost::container::flat_set<int> getOpenFds() {
   return fds;
 }
 
-template<class Runnable>
+template <class Runnable>
 void checkFdLeak(const Runnable& r) {
   // Get the currently open fds.  Check that they are the same both before and
   // after calling the specified function.  We read the open fds from /proc.
index 786d3a9bf8656bb7363ad2cb1581eda9ea6fcda8..fdf52a5f0cb5a8b3f8f89219f840ed2b6f7baa65 100644 (file)
@@ -43,7 +43,7 @@ inline void BM_fn_ptr_invoke_inlined_impl(int iters, void (*fn)()) {
 
 // Invoke a function object as a template parameter.
 // This can be used to directly invoke lambda functions
-template<typename T>
+template <typename T>
 void BM_invoke_fn_template_impl(int iters, const T& fn) {
   for (int n = 0; n < iters; ++n) {
     fn();
index 38e1d37be58dee1575bdef0fa528c9ee2ceb77ef..bae23e95286815b7ffc2c8fead6d243007fad1d6 100644 (file)
@@ -169,7 +169,7 @@ struct TestBasicGuarantee {
     throwCounter = 1000;
   }
 
-  template<class Operation>
+  template <class Operation>
   void operator()(int insertCount, Operation const& op) {
     bool done = false;
 
index 257b5dff56cc349a2a7df0408665229635cf40a9..2afae8afdfee68d4fe848158bee10cbd7515ef0c 100644 (file)
@@ -35,7 +35,7 @@ struct less_invert {
   }
 };
 
-template<class Container>
+template <class Container>
 void check_invariant(Container& c) {
   auto it = c.begin();
   auto end = c.end();
@@ -49,7 +49,7 @@ void check_invariant(Container& c) {
 }
 
 struct OneAtATimePolicy {
-  template<class Container>
+  template <class Container>
   void increase_capacity(Container& c) {
     if (c.size() == c.capacity()) {
       c.reserve(c.size() + 1);