Commit adf4a5ac authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Formatting for template parameters

Summary: [Folly] Formatting for template parameters.

Reviewed By: Orvid

Differential Revision: D5525123

fbshipit-source-id: 4feb772300cfdd6ae3168fe9f59f5a951fb85d0e
parent da591fe6
...@@ -26,8 +26,14 @@ ...@@ -26,8 +26,14 @@
namespace folly { namespace folly {
// AtomicHashArray private constructor -- // AtomicHashArray private constructor --
template <class KeyT, class ValueT, class HashFcn, class EqualFcn, template <
class Allocator, class ProbeFcn, class KeyConvertFcn> class KeyT,
class ValueT,
class HashFcn,
class EqualFcn,
class Allocator,
class ProbeFcn,
class KeyConvertFcn>
AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn, AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn,
Allocator, ProbeFcn, KeyConvertFcn>:: Allocator, ProbeFcn, KeyConvertFcn>::
AtomicHashArray(size_t capacity, KeyT emptyKey, KeyT lockedKey, AtomicHashArray(size_t capacity, KeyT emptyKey, KeyT lockedKey,
...@@ -46,8 +52,14 @@ AtomicHashArray(size_t capacity, KeyT emptyKey, KeyT lockedKey, ...@@ -46,8 +52,14 @@ AtomicHashArray(size_t capacity, KeyT emptyKey, KeyT lockedKey,
* of key and returns true, or if key does not exist returns false and * of key and returns true, or if key does not exist returns false and
* ret.index is set to capacity_. * ret.index is set to capacity_.
*/ */
template <class KeyT, class ValueT, class HashFcn, class EqualFcn, template <
class Allocator, class ProbeFcn, class KeyConvertFcn> class KeyT,
class ValueT,
class HashFcn,
class EqualFcn,
class Allocator,
class ProbeFcn,
class KeyConvertFcn>
template <class LookupKeyT, class LookupHashFcn, class LookupEqualFcn> template <class LookupKeyT, class LookupHashFcn, class LookupEqualFcn>
typename AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn, typename AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn,
Allocator, ProbeFcn, KeyConvertFcn>::SimpleRetT Allocator, ProbeFcn, KeyConvertFcn>::SimpleRetT
...@@ -88,13 +100,20 @@ findInternal(const LookupKeyT key_in) { ...@@ -88,13 +100,20 @@ findInternal(const LookupKeyT key_in) {
* this will be the previously inserted value, and if the map is full it is * this will be the previously inserted value, and if the map is full it is
* default. * default.
*/ */
template <class KeyT, class ValueT, class HashFcn, class EqualFcn, template <
class Allocator, class ProbeFcn, class KeyConvertFcn> class KeyT,
template <typename LookupKeyT, class ValueT,
typename LookupHashFcn, class HashFcn,
typename LookupEqualFcn, class EqualFcn,
typename LookupKeyToKeyFcn, class Allocator,
typename... ArgTs> class ProbeFcn,
class KeyConvertFcn>
template <
typename LookupKeyT,
typename LookupHashFcn,
typename LookupEqualFcn,
typename LookupKeyToKeyFcn,
typename... ArgTs>
typename AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn, typename AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn,
Allocator, ProbeFcn, KeyConvertFcn>::SimpleRetT Allocator, ProbeFcn, KeyConvertFcn>::SimpleRetT
AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn, AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn,
...@@ -222,8 +241,14 @@ insertInternal(LookupKeyT key_in, ArgTs&&... vCtorArgs) { ...@@ -222,8 +241,14 @@ insertInternal(LookupKeyT key_in, ArgTs&&... vCtorArgs) {
* erased key will never be reused. If there's an associated value, we won't * erased key will never be reused. If there's an associated value, we won't
* touch it either. * touch it either.
*/ */
template <class KeyT, class ValueT, class HashFcn, class EqualFcn, template <
class Allocator, class ProbeFcn, class KeyConvertFcn> class KeyT,
class ValueT,
class HashFcn,
class EqualFcn,
class Allocator,
class ProbeFcn,
class KeyConvertFcn>
size_t AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn, size_t AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn,
Allocator, ProbeFcn, KeyConvertFcn>:: Allocator, ProbeFcn, KeyConvertFcn>::
erase(KeyT key_in) { erase(KeyT key_in) {
...@@ -271,8 +296,14 @@ erase(KeyT key_in) { ...@@ -271,8 +296,14 @@ erase(KeyT key_in) {
} }
} }
template <class KeyT, class ValueT, class HashFcn, class EqualFcn, template <
class Allocator, class ProbeFcn, class KeyConvertFcn> class KeyT,
class ValueT,
class HashFcn,
class EqualFcn,
class Allocator,
class ProbeFcn,
class KeyConvertFcn>
typename AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn, typename AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn,
Allocator, ProbeFcn, KeyConvertFcn>::SmartPtr Allocator, ProbeFcn, KeyConvertFcn>::SmartPtr
AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn, AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn,
...@@ -314,8 +345,14 @@ create(size_t maxSize, const Config& c) { ...@@ -314,8 +345,14 @@ create(size_t maxSize, const Config& c) {
return map; return map;
} }
template <class KeyT, class ValueT, class HashFcn, class EqualFcn, template <
class Allocator, class ProbeFcn, class KeyConvertFcn> class KeyT,
class ValueT,
class HashFcn,
class EqualFcn,
class Allocator,
class ProbeFcn,
class KeyConvertFcn>
void AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn, void AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn,
Allocator, ProbeFcn, KeyConvertFcn>:: Allocator, ProbeFcn, KeyConvertFcn>::
destroy(AtomicHashArray* p) { destroy(AtomicHashArray* p) {
...@@ -334,8 +371,14 @@ destroy(AtomicHashArray* p) { ...@@ -334,8 +371,14 @@ destroy(AtomicHashArray* p) {
} }
// clear -- clears all keys and values in the map and resets all counters // clear -- clears all keys and values in the map and resets all counters
template <class KeyT, class ValueT, class HashFcn, class EqualFcn, template <
class Allocator, class ProbeFcn, class KeyConvertFcn> class KeyT,
class ValueT,
class HashFcn,
class EqualFcn,
class Allocator,
class ProbeFcn,
class KeyConvertFcn>
void AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn, void AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn,
Allocator, ProbeFcn, KeyConvertFcn>:: Allocator, ProbeFcn, KeyConvertFcn>::
clear() { clear() {
...@@ -355,8 +398,14 @@ clear() { ...@@ -355,8 +398,14 @@ clear() {
// Iterator implementation // Iterator implementation
template <class KeyT, class ValueT, class HashFcn, class EqualFcn, template <
class Allocator, class ProbeFcn, class KeyConvertFcn> class KeyT,
class ValueT,
class HashFcn,
class EqualFcn,
class Allocator,
class ProbeFcn,
class KeyConvertFcn>
template <class ContT, class IterVal> template <class ContT, class IterVal>
struct AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn, struct AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn,
Allocator, ProbeFcn, KeyConvertFcn>:: Allocator, ProbeFcn, KeyConvertFcn>::
......
...@@ -209,17 +209,19 @@ class AtomicHashArray : boost::noncopyable { ...@@ -209,17 +209,19 @@ class AtomicHashArray : boost::noncopyable {
* *
* See folly/test/ArrayHashArrayTest.cpp for sample usage. * See folly/test/ArrayHashArrayTest.cpp for sample usage.
*/ */
template <typename LookupKeyT = key_type, template <
typename LookupHashFcn = hasher, typename LookupKeyT = key_type,
typename LookupEqualFcn = key_equal> typename LookupHashFcn = hasher,
typename LookupEqualFcn = key_equal>
iterator find(LookupKeyT k) { iterator find(LookupKeyT k) {
return iterator(this, return iterator(this,
findInternal<LookupKeyT, LookupHashFcn, LookupEqualFcn>(k).idx); findInternal<LookupKeyT, LookupHashFcn, LookupEqualFcn>(k).idx);
} }
template <typename LookupKeyT = key_type, template <
typename LookupHashFcn = hasher, typename LookupKeyT = key_type,
typename LookupEqualFcn = key_equal> typename LookupHashFcn = hasher,
typename LookupEqualFcn = key_equal>
const_iterator find(LookupKeyT k) const { const_iterator find(LookupKeyT k) const {
return const_cast<AtomicHashArray*>(this)-> return const_cast<AtomicHashArray*>(this)->
find<LookupKeyT, LookupHashFcn, LookupEqualFcn>(k); find<LookupKeyT, LookupHashFcn, LookupEqualFcn>(k);
...@@ -254,11 +256,12 @@ class AtomicHashArray : boost::noncopyable { ...@@ -254,11 +256,12 @@ class AtomicHashArray : boost::noncopyable {
* equal key is already present, this method converts 'key_in' to a key of * equal key is already present, this method converts 'key_in' to a key of
* type KeyT using the provided LookupKeyToKeyFcn. * type KeyT using the provided LookupKeyToKeyFcn.
*/ */
template <typename LookupKeyT = key_type, template <
typename LookupHashFcn = hasher, typename LookupKeyT = key_type,
typename LookupEqualFcn = key_equal, typename LookupHashFcn = hasher,
typename LookupKeyToKeyFcn = key_convert, typename LookupEqualFcn = key_equal,
typename... ArgTs> typename LookupKeyToKeyFcn = key_convert,
typename... ArgTs>
std::pair<iterator,bool> emplace(LookupKeyT key_in, ArgTs&&... vCtorArgs) { std::pair<iterator,bool> emplace(LookupKeyT key_in, ArgTs&&... vCtorArgs) {
SimpleRetT ret = insertInternal<LookupKeyT, SimpleRetT ret = insertInternal<LookupKeyT,
LookupHashFcn, LookupHashFcn,
...@@ -350,9 +353,10 @@ friend class AtomicHashMap<KeyT, ...@@ -350,9 +353,10 @@ friend class AtomicHashMap<KeyT,
typename... ArgTs> typename... ArgTs>
SimpleRetT insertInternal(LookupKeyT key, ArgTs&&... vCtorArgs); SimpleRetT insertInternal(LookupKeyT key, ArgTs&&... vCtorArgs);
template <typename LookupKeyT = key_type, template <
typename LookupHashFcn = hasher, typename LookupKeyT = key_type,
typename LookupEqualFcn = key_equal> typename LookupHashFcn = hasher,
typename LookupEqualFcn = key_equal>
SimpleRetT findInternal(const LookupKeyT key); SimpleRetT findInternal(const LookupKeyT key);
template <typename MaybeKeyT> template <typename MaybeKeyT>
......
...@@ -54,18 +54,20 @@ AtomicHashMap< ...@@ -54,18 +54,20 @@ AtomicHashMap<
} }
// emplace -- // emplace --
template <typename KeyT, template <
typename ValueT, typename KeyT,
typename HashFcn, typename ValueT,
typename EqualFcn, typename HashFcn,
typename Allocator, typename EqualFcn,
typename ProbeFcn, typename Allocator,
typename KeyConvertFcn> typename ProbeFcn,
template <typename LookupKeyT, typename KeyConvertFcn>
typename LookupHashFcn, template <
typename LookupEqualFcn, typename LookupKeyT,
typename LookupKeyToKeyFcn, typename LookupHashFcn,
typename... ArgTs> typename LookupEqualFcn,
typename LookupKeyToKeyFcn,
typename... ArgTs>
std::pair<typename AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn, Allocator, std::pair<typename AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn, Allocator,
ProbeFcn, KeyConvertFcn>::iterator, bool> ProbeFcn, KeyConvertFcn>::iterator, bool>
AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn, AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn,
...@@ -82,18 +84,20 @@ emplace(LookupKeyT k, ArgTs&&... vCtorArgs) { ...@@ -82,18 +84,20 @@ emplace(LookupKeyT k, ArgTs&&... vCtorArgs) {
} }
// insertInternal -- Allocates new sub maps as existing ones fill up. // insertInternal -- Allocates new sub maps as existing ones fill up.
template <typename KeyT, template <
typename ValueT, typename KeyT,
typename HashFcn, typename ValueT,
typename EqualFcn, typename HashFcn,
typename Allocator, typename EqualFcn,
typename ProbeFcn, typename Allocator,
typename KeyConvertFcn> typename ProbeFcn,
template <typename LookupKeyT, typename KeyConvertFcn>
typename LookupHashFcn, template <
typename LookupEqualFcn, typename LookupKeyT,
typename LookupKeyToKeyFcn, typename LookupHashFcn,
typename... ArgTs> typename LookupEqualFcn,
typename LookupKeyToKeyFcn,
typename... ArgTs>
typename AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn, typename AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn,
Allocator, ProbeFcn, KeyConvertFcn>:: Allocator, ProbeFcn, KeyConvertFcn>::
SimpleRetT SimpleRetT
...@@ -176,13 +180,14 @@ insertInternal(LookupKeyT key, ArgTs&&... vCtorArgs) { ...@@ -176,13 +180,14 @@ insertInternal(LookupKeyT key, ArgTs&&... vCtorArgs) {
} }
// find -- // find --
template <typename KeyT, template <
typename ValueT, typename KeyT,
typename HashFcn, typename ValueT,
typename EqualFcn, typename HashFcn,
typename Allocator, typename EqualFcn,
typename ProbeFcn, typename Allocator,
typename KeyConvertFcn> typename ProbeFcn,
typename KeyConvertFcn>
template <class LookupKeyT, class LookupHashFcn, class LookupEqualFcn> template <class LookupKeyT, class LookupHashFcn, class LookupEqualFcn>
typename AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn, typename AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn,
Allocator, ProbeFcn, KeyConvertFcn>:: Allocator, ProbeFcn, KeyConvertFcn>::
...@@ -198,13 +203,14 @@ AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn, ...@@ -198,13 +203,14 @@ AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn,
return iterator(this, ret.i, subMap->makeIter(ret.j)); return iterator(this, ret.i, subMap->makeIter(ret.j));
} }
template <typename KeyT, template <
typename ValueT, typename KeyT,
typename HashFcn, typename ValueT,
typename EqualFcn, typename HashFcn,
typename Allocator, typename EqualFcn,
typename ProbeFcn, typename Allocator,
typename KeyConvertFcn> typename ProbeFcn,
typename KeyConvertFcn>
template <class LookupKeyT, class LookupHashFcn, class LookupEqualFcn> template <class LookupKeyT, class LookupHashFcn, class LookupEqualFcn>
typename AtomicHashMap<KeyT, ValueT, typename AtomicHashMap<KeyT, ValueT,
HashFcn, EqualFcn, Allocator, ProbeFcn, KeyConvertFcn>::const_iterator HashFcn, EqualFcn, Allocator, ProbeFcn, KeyConvertFcn>::const_iterator
...@@ -217,13 +223,14 @@ find(LookupKeyT k) const { ...@@ -217,13 +223,14 @@ find(LookupKeyT k) const {
} }
// findInternal -- // findInternal --
template <typename KeyT, template <
typename ValueT, typename KeyT,
typename HashFcn, typename ValueT,
typename EqualFcn, typename HashFcn,
typename Allocator, typename EqualFcn,
typename ProbeFcn, typename Allocator,
typename KeyConvertFcn> typename ProbeFcn,
typename KeyConvertFcn>
template <class LookupKeyT, class LookupHashFcn, class LookupEqualFcn> template <class LookupKeyT, class LookupHashFcn, class LookupEqualFcn>
typename AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn, typename AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn,
Allocator, ProbeFcn, KeyConvertFcn>:: Allocator, ProbeFcn, KeyConvertFcn>::
...@@ -256,13 +263,14 @@ AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn, ...@@ -256,13 +263,14 @@ AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn,
} }
// findAtInternal -- see encodeIndex() for details. // findAtInternal -- see encodeIndex() for details.
template <typename KeyT, template <
typename ValueT, typename KeyT,
typename HashFcn, typename ValueT,
typename EqualFcn, typename HashFcn,
typename Allocator, typename EqualFcn,
typename ProbeFcn, typename Allocator,
typename KeyConvertFcn> typename ProbeFcn,
typename KeyConvertFcn>
typename AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn, typename AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn,
Allocator, ProbeFcn, KeyConvertFcn>:: Allocator, ProbeFcn, KeyConvertFcn>::
SimpleRetT SimpleRetT
...@@ -285,13 +293,14 @@ findAtInternal(uint32_t idx) const { ...@@ -285,13 +293,14 @@ findAtInternal(uint32_t idx) const {
} }
// erase -- // erase --
template <typename KeyT, template <
typename ValueT, typename KeyT,
typename HashFcn, typename ValueT,
typename EqualFcn, typename HashFcn,
typename Allocator, typename EqualFcn,
typename ProbeFcn, typename Allocator,
typename KeyConvertFcn> typename ProbeFcn,
typename KeyConvertFcn>
typename AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn, typename AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn,
Allocator, ProbeFcn, KeyConvertFcn>:: Allocator, ProbeFcn, KeyConvertFcn>::
size_type size_type
...@@ -310,13 +319,14 @@ erase(const KeyT k) { ...@@ -310,13 +319,14 @@ erase(const KeyT k) {
} }
// capacity -- summation of capacities of all submaps // capacity -- summation of capacities of all submaps
template <typename KeyT, template <
typename ValueT, typename KeyT,
typename HashFcn, typename ValueT,
typename EqualFcn, typename HashFcn,
typename Allocator, typename EqualFcn,
typename ProbeFcn, typename Allocator,
typename KeyConvertFcn> typename ProbeFcn,
typename KeyConvertFcn>
size_t AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn, size_t AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn,
Allocator, ProbeFcn, KeyConvertFcn>:: Allocator, ProbeFcn, KeyConvertFcn>::
capacity() const { capacity() const {
...@@ -330,13 +340,14 @@ capacity() const { ...@@ -330,13 +340,14 @@ capacity() const {
// spaceRemaining -- // spaceRemaining --
// number of new insertions until current submaps are all at max load // number of new insertions until current submaps are all at max load
template <typename KeyT, template <
typename ValueT, typename KeyT,
typename HashFcn, typename ValueT,
typename EqualFcn, typename HashFcn,
typename Allocator, typename EqualFcn,
typename ProbeFcn, typename Allocator,
typename KeyConvertFcn> typename ProbeFcn,
typename KeyConvertFcn>
size_t AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn, size_t AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn,
Allocator, ProbeFcn, KeyConvertFcn>:: Allocator, ProbeFcn, KeyConvertFcn>::
spaceRemaining() const { spaceRemaining() const {
...@@ -354,13 +365,14 @@ spaceRemaining() const { ...@@ -354,13 +365,14 @@ spaceRemaining() const {
// clear -- Wipes all keys and values from primary map and destroys // clear -- Wipes all keys and values from primary map and destroys
// all secondary maps. Not thread safe. // all secondary maps. Not thread safe.
template <typename KeyT, template <
typename ValueT, typename KeyT,
typename HashFcn, typename ValueT,
typename EqualFcn, typename HashFcn,
typename Allocator, typename EqualFcn,
typename ProbeFcn, typename Allocator,
typename KeyConvertFcn> typename ProbeFcn,
typename KeyConvertFcn>
void AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn, void AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn,
Allocator, ProbeFcn, KeyConvertFcn>:: Allocator, ProbeFcn, KeyConvertFcn>::
clear() { clear() {
...@@ -377,13 +389,14 @@ clear() { ...@@ -377,13 +389,14 @@ clear() {
} }
// size -- // size --
template <typename KeyT, template <
typename ValueT, typename KeyT,
typename HashFcn, typename ValueT,
typename EqualFcn, typename HashFcn,
typename Allocator, typename EqualFcn,
typename ProbeFcn, typename Allocator,
typename KeyConvertFcn> typename ProbeFcn,
typename KeyConvertFcn>
size_t AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn, size_t AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn,
Allocator, ProbeFcn, KeyConvertFcn>:: Allocator, ProbeFcn, KeyConvertFcn>::
size() const { size() const {
...@@ -413,13 +426,14 @@ size() const { ...@@ -413,13 +426,14 @@ size() const {
// 31 1 // 31 1
// 27-30 which subMap // 27-30 which subMap
// 0-26 subMap offset (index_ret input) // 0-26 subMap offset (index_ret input)
template <typename KeyT, template <
typename ValueT, typename KeyT,
typename HashFcn, typename ValueT,
typename EqualFcn, typename HashFcn,
typename Allocator, typename EqualFcn,
typename ProbeFcn, typename Allocator,
typename KeyConvertFcn> typename ProbeFcn,
typename KeyConvertFcn>
inline uint32_t inline uint32_t
AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn, AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn,
Allocator, ProbeFcn, KeyConvertFcn>:: Allocator, ProbeFcn, KeyConvertFcn>::
...@@ -438,13 +452,14 @@ AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn, ...@@ -438,13 +452,14 @@ AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn,
// Iterator implementation // Iterator implementation
template <typename KeyT, template <
typename ValueT, typename KeyT,
typename HashFcn, typename ValueT,
typename EqualFcn, typename HashFcn,
typename Allocator, typename EqualFcn,
typename ProbeFcn, typename Allocator,
typename KeyConvertFcn> typename ProbeFcn,
typename KeyConvertFcn>
template <class ContT, class IterVal, class SubIt> template <class ContT, class IterVal, class SubIt>
struct AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn, struct AtomicHashMap<KeyT, ValueT, HashFcn, EqualFcn,
Allocator, ProbeFcn, KeyConvertFcn>:: Allocator, ProbeFcn, KeyConvertFcn>::
......
...@@ -254,11 +254,12 @@ typedef AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn, ...@@ -254,11 +254,12 @@ typedef AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn,
* equal key is already present, this method converts 'key_in' to a key of * equal key is already present, this method converts 'key_in' to a key of
* type KeyT using the provided LookupKeyToKeyFcn. * type KeyT using the provided LookupKeyToKeyFcn.
*/ */
template <typename LookupKeyT = key_type, template <
typename LookupHashFcn = hasher, typename LookupKeyT = key_type,
typename LookupEqualFcn = key_equal, typename LookupHashFcn = hasher,
typename LookupKeyToKeyFcn = key_convert, typename LookupEqualFcn = key_equal,
typename... ArgTs> typename LookupKeyToKeyFcn = key_convert,
typename... ArgTs>
std::pair<iterator,bool> emplace(LookupKeyT k, ArgTs&&... vCtorArg); std::pair<iterator,bool> emplace(LookupKeyT k, ArgTs&&... vCtorArg);
/* /*
...@@ -277,14 +278,16 @@ typedef AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn, ...@@ -277,14 +278,16 @@ typedef AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn,
* *
* See folly/test/ArrayHashMapTest.cpp for sample usage. * See folly/test/ArrayHashMapTest.cpp for sample usage.
*/ */
template <typename LookupKeyT = key_type, template <
typename LookupHashFcn = hasher, typename LookupKeyT = key_type,
typename LookupEqualFcn = key_equal> typename LookupHashFcn = hasher,
typename LookupEqualFcn = key_equal>
iterator find(LookupKeyT k); iterator find(LookupKeyT k);
template <typename LookupKeyT = key_type, template <
typename LookupHashFcn = hasher, typename LookupKeyT = key_type,
typename LookupEqualFcn = key_equal> typename LookupHashFcn = hasher,
typename LookupEqualFcn = key_equal>
const_iterator find(LookupKeyT k) const; const_iterator find(LookupKeyT k) const;
/* /*
...@@ -437,16 +440,18 @@ typedef AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn, ...@@ -437,16 +440,18 @@ typedef AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn,
SimpleRetT() = default; SimpleRetT() = default;
}; };
template <typename LookupKeyT = key_type, template <
typename LookupHashFcn = hasher, typename LookupKeyT = key_type,
typename LookupEqualFcn = key_equal, typename LookupHashFcn = hasher,
typename LookupKeyToKeyFcn = key_convert, typename LookupEqualFcn = key_equal,
typename... ArgTs> typename LookupKeyToKeyFcn = key_convert,
typename... ArgTs>
SimpleRetT insertInternal(LookupKeyT key, ArgTs&&... value); SimpleRetT insertInternal(LookupKeyT key, ArgTs&&... value);
template <typename LookupKeyT = key_type, template <
typename LookupHashFcn = hasher, typename LookupKeyT = key_type,
typename LookupEqualFcn = key_equal> typename LookupHashFcn = hasher,
typename LookupEqualFcn = key_equal>
SimpleRetT findInternal(const LookupKeyT k) const; SimpleRetT findInternal(const LookupKeyT k) const;
SimpleRetT findAtInternal(uint32_t idx) const; SimpleRetT findAtInternal(uint32_t idx) const;
...@@ -464,11 +469,12 @@ typedef AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn, ...@@ -464,11 +469,12 @@ typedef AtomicHashArray<KeyT, ValueT, HashFcn, EqualFcn,
}; // AtomicHashMap }; // AtomicHashMap
template <class KeyT, template <
class ValueT, class KeyT,
class HashFcn = std::hash<KeyT>, class ValueT,
class EqualFcn = std::equal_to<KeyT>, class HashFcn = std::hash<KeyT>,
class Allocator = std::allocator<char>> class EqualFcn = std::equal_to<KeyT>,
class Allocator = std::allocator<char>>
using QuadraticProbingAtomicHashMap = using QuadraticProbingAtomicHashMap =
AtomicHashMap<KeyT, AtomicHashMap<KeyT,
ValueT, ValueT,
......
...@@ -479,15 +479,16 @@ struct AtomicUnorderedInsertMap { ...@@ -479,15 +479,16 @@ struct AtomicUnorderedInsertMap {
/// to select a 64 bit slot index type. Use this if you need a capacity /// to select a 64 bit slot index type. Use this if you need a capacity
/// bigger than 2^30 (about a billion). This increases memory overheads, /// bigger than 2^30 (about a billion). This increases memory overheads,
/// obviously. /// obviously.
template <typename Key, template <
typename Value, typename Key,
typename Hash = std::hash<Key>, typename Value,
typename KeyEqual = std::equal_to<Key>, typename Hash = std::hash<Key>,
bool SkipKeyValueDeletion = typename KeyEqual = std::equal_to<Key>,
(boost::has_trivial_destructor<Key>::value && bool SkipKeyValueDeletion =
boost::has_trivial_destructor<Value>::value), (boost::has_trivial_destructor<Key>::value &&
template <typename> class Atom = std::atomic, boost::has_trivial_destructor<Value>::value),
typename Allocator = folly::detail::MMapAlloc> template <typename> class Atom = std::atomic,
typename Allocator = folly::detail::MMapAlloc>
using AtomicUnorderedInsertMap64 = using AtomicUnorderedInsertMap64 =
AtomicUnorderedInsertMap<Key, AtomicUnorderedInsertMap<Key,
Value, Value,
......
...@@ -1045,10 +1045,11 @@ class dummy_fbstring_core { ...@@ -1045,10 +1045,11 @@ class dummy_fbstring_core {
#ifdef _LIBSTDCXX_FBSTRING #ifdef _LIBSTDCXX_FBSTRING
template <typename E, class T, class A, class Storage> template <typename E, class T, class A, class Storage>
#else #else
template <typename E, template <
class T = std::char_traits<E>, typename E,
class A = std::allocator<E>, class T = std::char_traits<E>,
class Storage = fbstring_core<E> > class A = std::allocator<E>,
class Storage = fbstring_core<E>>
#endif #endif
class basic_fbstring { class basic_fbstring {
static void enforce( static void enforce(
......
...@@ -1307,9 +1307,10 @@ struct SingleElementQueue { ...@@ -1307,9 +1307,10 @@ struct SingleElementQueue {
} }
/// enqueue using in-place noexcept construction /// enqueue using in-place noexcept construction
template <typename ...Args, template <
typename = typename std::enable_if< typename... Args,
std::is_nothrow_constructible<T,Args...>::value>::type> typename = typename std::enable_if<
std::is_nothrow_constructible<T, Args...>::value>::type>
void enqueue(const uint32_t turn, void enqueue(const uint32_t turn,
Atom<uint32_t>& spinCutoff, Atom<uint32_t>& spinCutoff,
const bool updateSpinCutoff, const bool updateSpinCutoff,
......
...@@ -69,8 +69,9 @@ template <class Iter> class Range; ...@@ -69,8 +69,9 @@ template <class Iter> class Range;
* as Boyer-Moore. On the upside, it does not do any upfront * as Boyer-Moore. On the upside, it does not do any upfront
* preprocessing and does not allocate memory. * preprocessing and does not allocate memory.
*/ */
template <class Iter, template <
class Comp = std::equal_to<typename Range<Iter>::value_type>> class Iter,
class Comp = std::equal_to<typename Range<Iter>::value_type>>
inline size_t qfind(const Range<Iter> & haystack, inline size_t qfind(const Range<Iter> & haystack,
const Range<Iter> & needle, const Range<Iter> & needle,
Comp eq = Comp()); Comp eq = Comp());
......
...@@ -236,10 +236,11 @@ struct SharedMutexToken { ...@@ -236,10 +236,11 @@ struct SharedMutexToken {
uint16_t slot_; uint16_t slot_;
}; };
template <bool ReaderPriority, template <
typename Tag_ = void, bool ReaderPriority,
template <typename> class Atom = std::atomic, typename Tag_ = void,
bool BlockImmediately = false> template <typename> class Atom = std::atomic,
bool BlockImmediately = false>
class SharedMutexImpl { class SharedMutexImpl {
public: public:
static constexpr bool kReaderPriority = ReaderPriority; static constexpr bool kReaderPriority = ReaderPriority;
......
...@@ -532,9 +532,10 @@ class SingletonVault { ...@@ -532,9 +532,10 @@ class SingletonVault {
// singletons. Create instances of this class in the global scope of // singletons. Create instances of this class in the global scope of
// type Singleton<T> to register your singleton for later access via // type Singleton<T> to register your singleton for later access via
// Singleton<T>::try_get(). // Singleton<T>::try_get().
template <typename T, template <
typename Tag = detail::DefaultTag, typename T,
typename VaultTag = detail::DefaultTag /* for testing */> typename Tag = detail::DefaultTag,
typename VaultTag = detail::DefaultTag /* for testing */>
class Singleton { class Singleton {
public: public:
typedef std::function<T*(void)> CreateFunc; typedef std::function<T*(void)> CreateFunc;
......
...@@ -561,11 +561,12 @@ std::string join(const Delim& delimiter, ...@@ -561,11 +561,12 @@ std::string join(const Delim& delimiter,
return output; return output;
} }
template <class Delim, template <
class Iterator, class Delim,
typename std::enable_if<std::is_same< class Iterator,
typename std::iterator_traits<Iterator>::iterator_category, typename std::enable_if<std::is_same<
std::random_access_iterator_tag>::value>::type* = nullptr> typename std::iterator_traits<Iterator>::iterator_category,
std::random_access_iterator_tag>::value>::type* = nullptr>
std::string join(const Delim& delimiter, Iterator begin, Iterator end) { std::string join(const Delim& delimiter, Iterator begin, Iterator end) {
std::string output; std::string output;
join(delimiter, begin, end, output); join(delimiter, begin, end, output);
...@@ -625,8 +626,9 @@ inline void toLowerAscii(MutableStringPiece str) { ...@@ -625,8 +626,9 @@ inline void toLowerAscii(MutableStringPiece str) {
toLowerAscii(str.begin(), str.size()); toLowerAscii(str.begin(), str.size());
} }
template <class Iterator = const char*, template <
class Base = folly::Range<boost::u8_to_u32_iterator<Iterator>>> class Iterator = const char*,
class Base = folly::Range<boost::u8_to_u32_iterator<Iterator>>>
class UTF8Range : public Base { class UTF8Range : public Base {
public: public:
/* implicit */ UTF8Range(const folly::Range<Iterator> baseRange) /* implicit */ UTF8Range(const folly::Range<Iterator> baseRange)
......
...@@ -110,14 +110,15 @@ struct MemoryIdler { ...@@ -110,14 +110,15 @@ struct MemoryIdler {
/// (1 + timeoutVariationFraction), to smooth out the behavior in a /// (1 + timeoutVariationFraction), to smooth out the behavior in a
/// system with bursty requests. The default is to wait up to 50% /// system with bursty requests. The default is to wait up to 50%
/// extra, so on average 25% extra /// extra, so on average 25% extra
template <template <typename> class Atom, template <
typename Clock = std::chrono::steady_clock> template <typename> class Atom,
typename Clock = std::chrono::steady_clock>
static bool futexWait( static bool futexWait(
Futex<Atom>& fut, Futex<Atom>& fut,
uint32_t expected, uint32_t expected,
uint32_t waitMask = -1, uint32_t waitMask = -1,
typename Clock::duration idleTimeout typename Clock::duration idleTimeout =
= defaultIdleTimeout.load(std::memory_order_acquire), defaultIdleTimeout.load(std::memory_order_acquire),
size_t stackToRetain = kDefaultStackToRetain, size_t stackToRetain = kDefaultStackToRetain,
float timeoutVariationFrac = 0.5) { float timeoutVariationFrac = 0.5) {
......
...@@ -70,10 +70,11 @@ struct BitVectorCompressedListBase { ...@@ -70,10 +70,11 @@ struct BitVectorCompressedListBase {
typedef BitVectorCompressedListBase<const uint8_t*> BitVectorCompressedList; typedef BitVectorCompressedListBase<const uint8_t*> BitVectorCompressedList;
typedef BitVectorCompressedListBase<uint8_t*> MutableBitVectorCompressedList; typedef BitVectorCompressedListBase<uint8_t*> MutableBitVectorCompressedList;
template <class Value, template <
class SkipValue, class Value,
size_t kSkipQuantum = 0, class SkipValue,
size_t kForwardQuantum = 0> size_t kSkipQuantum = 0,
size_t kForwardQuantum = 0>
struct BitVectorEncoder { struct BitVectorEncoder {
static_assert(std::is_integral<Value>::value && static_assert(std::is_integral<Value>::value &&
std::is_unsigned<Value>::value, std::is_unsigned<Value>::value,
...@@ -165,10 +166,11 @@ struct BitVectorEncoder { ...@@ -165,10 +166,11 @@ struct BitVectorEncoder {
MutableCompressedList result_; MutableCompressedList result_;
}; };
template <class Value, template <
class SkipValue, class Value,
size_t kSkipQuantum, class SkipValue,
size_t kForwardQuantum> size_t kSkipQuantum,
size_t kForwardQuantum>
struct BitVectorEncoder<Value, SkipValue, kSkipQuantum, kForwardQuantum>:: struct BitVectorEncoder<Value, SkipValue, kSkipQuantum, kForwardQuantum>::
Layout { Layout {
static Layout fromUpperBoundAndSize(size_t upperBound, size_t size) { static Layout fromUpperBoundAndSize(size_t upperBound, size_t size) {
......
...@@ -86,10 +86,11 @@ struct EliasFanoCompressedListBase { ...@@ -86,10 +86,11 @@ struct EliasFanoCompressedListBase {
typedef EliasFanoCompressedListBase<const uint8_t*> EliasFanoCompressedList; typedef EliasFanoCompressedListBase<const uint8_t*> EliasFanoCompressedList;
typedef EliasFanoCompressedListBase<uint8_t*> MutableEliasFanoCompressedList; typedef EliasFanoCompressedListBase<uint8_t*> MutableEliasFanoCompressedList;
template <class Value, template <
class SkipValue = size_t, class Value,
size_t kSkipQuantum = 0, // 0 = disabled class SkipValue = size_t,
size_t kForwardQuantum = 0> // 0 = disabled size_t kSkipQuantum = 0, // 0 = disabled
size_t kForwardQuantum = 0> // 0 = disabled
struct EliasFanoEncoderV2 { struct EliasFanoEncoderV2 {
static_assert(std::is_integral<Value>::value && static_assert(std::is_integral<Value>::value &&
std::is_unsigned<Value>::value, std::is_unsigned<Value>::value,
...@@ -216,10 +217,11 @@ struct EliasFanoEncoderV2 { ...@@ -216,10 +217,11 @@ struct EliasFanoEncoderV2 {
MutableCompressedList result_; MutableCompressedList result_;
}; };
template <class Value, template <
class SkipValue, class Value,
size_t kSkipQuantum, class SkipValue,
size_t kForwardQuantum> size_t kSkipQuantum,
size_t kForwardQuantum>
struct EliasFanoEncoderV2<Value, struct EliasFanoEncoderV2<Value,
SkipValue, SkipValue,
kSkipQuantum, kSkipQuantum,
......
...@@ -34,9 +34,10 @@ namespace folly { ...@@ -34,9 +34,10 @@ namespace folly {
* It uses kind of hack: string pointed by StringPiece is copied when * It uses kind of hack: string pointed by StringPiece is copied when
* StringPiece is inserted into map * StringPiece is inserted into map
*/ */
template <class Value, template <
class Compare = std::less<StringPiece>, class Value,
class Alloc = std::allocator<std::pair<const StringPiece, Value>>> class Compare = std::less<StringPiece>,
class Alloc = std::allocator<std::pair<const StringPiece, Value>>>
class StringKeyedMap class StringKeyedMap
: private std::map<StringPiece, Value, Compare, Alloc> { : private std::map<StringPiece, Value, Compare, Alloc> {
private: private:
......
...@@ -34,8 +34,9 @@ namespace folly { ...@@ -34,8 +34,9 @@ namespace folly {
* It uses kind of hack: string pointed by StringPiece is copied when * It uses kind of hack: string pointed by StringPiece is copied when
* StringPiece is inserted into set * StringPiece is inserted into set
*/ */
template <class Compare = std::less<StringPiece>, template <
class Alloc = std::allocator<StringPiece>> class Compare = std::less<StringPiece>,
class Alloc = std::allocator<StringPiece>>
class StringKeyedSetBase class StringKeyedSetBase
: private std::set<StringPiece, Compare, Alloc> { : private std::set<StringPiece, Compare, Alloc> {
private: private:
......
...@@ -66,12 +66,13 @@ struct TemplateRange< ...@@ -66,12 +66,13 @@ struct TemplateRange<
// where k = min(tuple_size<T>::value - start, n) // where k = min(tuple_size<T>::value - start, n)
// (that is, it's a TemplateSeq of at most n elements, but won't extend // (that is, it's a TemplateSeq of at most n elements, but won't extend
// past the end of the given tuple) // past the end of the given tuple)
template <class T, template <
std::size_t start = 0, class T,
std::size_t n = std::numeric_limits<std::size_t>::max(), std::size_t start = 0,
std::size_t size = std::size_t n = std::numeric_limits<std::size_t>::max(),
std::tuple_size<typename std::remove_reference<T>::type>::value, std::size_t size =
class Enable = typename std::enable_if<(start <= size)>::type> std::tuple_size<typename std::remove_reference<T>::type>::value,
class Enable = typename std::enable_if<(start <= size)>::type>
struct TemplateTupleRange { struct TemplateTupleRange {
using type = typename TemplateRange< using type = typename TemplateRange<
std::size_t, std::size_t,
......
...@@ -119,10 +119,12 @@ struct TupleTo2<TemplateSeq<std::size_t, Ns...>> { ...@@ -119,10 +119,12 @@ struct TupleTo2<TemplateSeq<std::size_t, Ns...>> {
} }
}; };
template <class U, class T, template <
class Seq = typename TemplateTupleRange<U>::type, class U,
class Enable = typename std::enable_if< class T,
(std::tuple_size<U>::value == std::tuple_size<T>::value)>::type> class Seq = typename TemplateTupleRange<U>::type,
class Enable = typename std::enable_if<
(std::tuple_size<U>::value == std::tuple_size<T>::value)>::type>
U tupleTo2(const T& input) { U tupleTo2(const T& input) {
return TupleTo2<Seq>::template convert<U>(input); return TupleTo2<Seq>::template convert<U>(input);
} }
......
...@@ -439,8 +439,11 @@ void collectVariadicHelper(const std::shared_ptr<T<Ts...>>& /* ctx */) { ...@@ -439,8 +439,11 @@ void collectVariadicHelper(const std::shared_ptr<T<Ts...>>& /* ctx */) {
// base case // base case
} }
template <template <typename ...> class T, typename... Ts, template <
typename THead, typename... TTail> template <typename...> class T,
typename... Ts,
typename THead,
typename... TTail>
void collectVariadicHelper(const std::shared_ptr<T<Ts...>>& ctx, void collectVariadicHelper(const std::shared_ptr<T<Ts...>>& ctx,
THead&& head, TTail&&... tail) { THead&& head, TTail&&... tail) {
using ValueType = typename std::decay<THead>::type::value_type; using ValueType = typename std::decay<THead>::type::value_type;
......
...@@ -93,10 +93,12 @@ namespace futures { ...@@ -93,10 +93,12 @@ namespace futures {
* Set func as the callback for each input Future and return a vector of * Set func as the callback for each input Future and return a vector of
* Futures containing the results in the input order. * Futures containing the results in the input order.
*/ */
template <class It, class F, template <
class ItT = typename std::iterator_traits<It>::value_type, class It,
class Result class F,
= typename decltype(std::declval<ItT>().then(std::declval<F>()))::value_type> class ItT = typename std::iterator_traits<It>::value_type,
class Result = typename decltype(
std::declval<ItT>().then(std::declval<F>()))::value_type>
std::vector<Future<Result>> map(It first, It last, F func); std::vector<Future<Result>> map(It first, It last, F func);
// Sugar for the most common case // Sugar for the most common case
...@@ -363,9 +365,12 @@ auto reduce(Collection&& c, T&& initial, F&& func) ...@@ -363,9 +365,12 @@ auto reduce(Collection&& c, T&& initial, F&& func)
/** like reduce, but calls func on finished futures as they complete /** like reduce, but calls func on finished futures as they complete
does NOT keep the order of the input does NOT keep the order of the input
*/ */
template <class It, class T, class F, template <
class ItT = typename std::iterator_traits<It>::value_type::value_type, class It,
class Arg = MaybeTryArg<F, T, ItT>> class T,
class F,
class ItT = typename std::iterator_traits<It>::value_type::value_type,
class Arg = MaybeTryArg<F, T, ItT>>
Future<T> unorderedReduce(It first, It last, T initial, F func); Future<T> unorderedReduce(It first, It last, T initial, F func);
/// Sugar for the most common case /// Sugar for the most common case
......
...@@ -89,10 +89,11 @@ pair<KeyT,ValueT> createEntry(int i) { ...@@ -89,10 +89,11 @@ pair<KeyT,ValueT> createEntry(int i) {
to<ValueT>(i + 3)); to<ValueT>(i + 3));
} }
template <class KeyT, template <
class ValueT, class KeyT,
class Allocator = std::allocator<char>, class ValueT,
class ProbeFcn = AtomicHashArrayLinearProbeFcn> class Allocator = std::allocator<char>,
class ProbeFcn = AtomicHashArrayLinearProbeFcn>
void testMap() { void testMap() {
typedef AtomicHashArray<KeyT, ValueT, std::hash<KeyT>, typedef AtomicHashArray<KeyT, ValueT, std::hash<KeyT>,
std::equal_to<KeyT>, Allocator, ProbeFcn> MyArr; std::equal_to<KeyT>, Allocator, ProbeFcn> MyArr;
......
...@@ -88,11 +88,12 @@ struct non_atomic { ...@@ -88,11 +88,12 @@ struct non_atomic {
bool is_lock_free() const {return true;} bool is_lock_free() const {return true;}
}; };
template <typename Key, template <
typename Value, typename Key,
typename IndexType, typename Value,
template <typename> class Atom = std::atomic, typename IndexType,
typename Allocator = std::allocator<char>> template <typename> class Atom = std::atomic,
typename Allocator = std::allocator<char>>
using UIM = using UIM =
AtomicUnorderedInsertMap<Key, AtomicUnorderedInsertMap<Key,
Value, Value,
......
...@@ -381,9 +381,10 @@ struct WriteCaller : public WriteMethodCaller<Q> { ...@@ -381,9 +381,10 @@ struct WriteCaller : public WriteMethodCaller<Q> {
string methodName() override { return "write"; } string methodName() override { return "write"; }
}; };
template <typename Q, template <
class Clock = steady_clock, typename Q,
class Duration = typename Clock::duration> class Clock = steady_clock,
class Duration = typename Clock::duration>
struct TryWriteUntilCaller : public WriteMethodCaller<Q> { struct TryWriteUntilCaller : public WriteMethodCaller<Q> {
const Duration duration_; const Duration duration_;
explicit TryWriteUntilCaller(Duration&& duration) : duration_(duration) {} explicit TryWriteUntilCaller(Duration&& duration) : duration_(duration) {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment