mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
Unification [#CLICKHOUSE-2].
This commit is contained in:
parent
e29b0e1750
commit
86c46ad1bd
@ -8,7 +8,7 @@ namespace DB
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
template <template <typename, typename> class AggregateFunctionTemplate, class Data, typename ... TArgs>
|
template <template <typename, typename> class AggregateFunctionTemplate, typename Data, typename ... TArgs>
|
||||||
static IAggregateFunction * createWithNumericOrTimeType(const IDataType & argument_type, TArgs && ... args)
|
static IAggregateFunction * createWithNumericOrTimeType(const IDataType & argument_type, TArgs && ... args)
|
||||||
{
|
{
|
||||||
if (typeid_cast<const DataTypeDate *>(&argument_type)) return new AggregateFunctionTemplate<UInt16, Data>(std::forward<TArgs>(args)...);
|
if (typeid_cast<const DataTypeDate *>(&argument_type)) return new AggregateFunctionTemplate<UInt16, Data>(std::forward<TArgs>(args)...);
|
||||||
|
@ -34,7 +34,7 @@ static IAggregateFunction * createWithNumericType(const IDataType & argument_typ
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <template <typename, typename> class AggregateFunctionTemplate, class Data>
|
template <template <typename, typename> class AggregateFunctionTemplate, typename Data>
|
||||||
static IAggregateFunction * createWithNumericType(const IDataType & argument_type)
|
static IAggregateFunction * createWithNumericType(const IDataType & argument_type)
|
||||||
{
|
{
|
||||||
if (typeid_cast<const DataTypeUInt8 *>(&argument_type)) return new AggregateFunctionTemplate<UInt8, Data>;
|
if (typeid_cast<const DataTypeUInt8 *>(&argument_type)) return new AggregateFunctionTemplate<UInt8, Data>;
|
||||||
@ -53,7 +53,7 @@ static IAggregateFunction * createWithNumericType(const IDataType & argument_typ
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <template <typename, typename> class AggregateFunctionTemplate, class Data, typename ... TArgs>
|
template <template <typename, typename> class AggregateFunctionTemplate, typename Data, typename ... TArgs>
|
||||||
static IAggregateFunction * createWithNumericType(const IDataType & argument_type, TArgs && ... args)
|
static IAggregateFunction * createWithNumericType(const IDataType & argument_type, TArgs && ... args)
|
||||||
{
|
{
|
||||||
if (typeid_cast<const DataTypeUInt8 *>(&argument_type)) return new AggregateFunctionTemplate<UInt8, Data>(std::forward<TArgs>(args)...);
|
if (typeid_cast<const DataTypeUInt8 *>(&argument_type)) return new AggregateFunctionTemplate<UInt8, Data>(std::forward<TArgs>(args)...);
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
template <class T, bool is_nothrow_move_assignable = std::is_nothrow_move_assignable<T>::value>
|
template <typename T, bool is_nothrow_move_assignable = std::is_nothrow_move_assignable<T>::value>
|
||||||
struct MoveOrCopyIfThrow;
|
struct MoveOrCopyIfThrow;
|
||||||
|
|
||||||
template <class T>
|
template <typename T>
|
||||||
struct MoveOrCopyIfThrow<T, true>
|
struct MoveOrCopyIfThrow<T, true>
|
||||||
{
|
{
|
||||||
void operator()(T && src, T & dst) const
|
void operator()(T && src, T & dst) const
|
||||||
@ -23,7 +23,7 @@ namespace detail
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <typename T>
|
||||||
struct MoveOrCopyIfThrow<T, false>
|
struct MoveOrCopyIfThrow<T, false>
|
||||||
{
|
{
|
||||||
void operator()(T && src, T & dst) const
|
void operator()(T && src, T & dst) const
|
||||||
@ -32,7 +32,7 @@ namespace detail
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <typename T>
|
||||||
void moveOrCopyIfThrow(T && src, T & dst)
|
void moveOrCopyIfThrow(T && src, T & dst)
|
||||||
{
|
{
|
||||||
MoveOrCopyIfThrow<T>()(std::forward<T>(src), dst);
|
MoveOrCopyIfThrow<T>()(std::forward<T>(src), dst);
|
||||||
|
@ -19,7 +19,7 @@ public:
|
|||||||
ZooKeeperHolder() = default;
|
ZooKeeperHolder() = default;
|
||||||
|
|
||||||
/// вызывать из одного потока - не thread safe
|
/// вызывать из одного потока - не thread safe
|
||||||
template <class... Args>
|
template <typename... Args>
|
||||||
void init(Args&&... args);
|
void init(Args&&... args);
|
||||||
/// был ли класс инициализирован
|
/// был ли класс инициализирован
|
||||||
bool isInitialized() const { return ptr != nullptr; }
|
bool isInitialized() const { return ptr != nullptr; }
|
||||||
@ -75,7 +75,7 @@ private:
|
|||||||
static std::string nullptr_exception_message;
|
static std::string nullptr_exception_message;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class... Args>
|
template <typename... Args>
|
||||||
void ZooKeeperHolder::init(Args&&... args)
|
void ZooKeeperHolder::init(Args&&... args)
|
||||||
{
|
{
|
||||||
ptr = std::make_shared<ZooKeeper>(std::forward<Args>(args)...);
|
ptr = std::make_shared<ZooKeeper>(std::forward<Args>(args)...);
|
||||||
|
@ -146,7 +146,7 @@ private:
|
|||||||
* Grow the map by GrowthFactor::num/GrowthFactor::den and use a modulo to map a hash
|
* Grow the map by GrowthFactor::num/GrowthFactor::den and use a modulo to map a hash
|
||||||
* to a bucket. Slower but it can be usefull if you want a slower growth.
|
* to a bucket. Slower but it can be usefull if you want a slower growth.
|
||||||
*/
|
*/
|
||||||
template<class GrowthFactor = std::ratio<3, 2>>
|
template <typename GrowthFactor = std::ratio<3, 2>>
|
||||||
class mod_growth_policy {
|
class mod_growth_policy {
|
||||||
public:
|
public:
|
||||||
mod_growth_policy(std::size_t& min_bucket_count_in_out) {
|
mod_growth_policy(std::size_t& min_bucket_count_in_out) {
|
||||||
@ -617,7 +617,7 @@ private:
|
|||||||
* OverflowContainer will be used as containers for overflown elements. Usually it should be a list<ValueType>
|
* OverflowContainer will be used as containers for overflown elements. Usually it should be a list<ValueType>
|
||||||
* or a set<Key>/map<Key, T>.
|
* or a set<Key>/map<Key, T>.
|
||||||
*/
|
*/
|
||||||
template<class ValueType,
|
template <typename ValueType,
|
||||||
class KeySelect,
|
class KeySelect,
|
||||||
class ValueSelect,
|
class ValueSelect,
|
||||||
class Hash,
|
class Hash,
|
||||||
@ -724,7 +724,7 @@ public:
|
|||||||
return KeySelect()(*m_overflow_iterator);
|
return KeySelect()(*m_overflow_iterator);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class U = ValueSelect, typename std::enable_if<has_mapped_type<U>::value>::type* = nullptr>
|
template <typename U = ValueSelect, typename std::enable_if<has_mapped_type<U>::value>::type* = nullptr>
|
||||||
typename std::conditional<
|
typename std::conditional<
|
||||||
is_const,
|
is_const,
|
||||||
const typename U::value_type&,
|
const typename U::value_type&,
|
||||||
@ -791,7 +791,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template<class OC = OverflowContainer, typename std::enable_if<!has_key_compare<OC>::value>::type* = nullptr>
|
template <typename OC = OverflowContainer, typename std::enable_if<!has_key_compare<OC>::value>::type* = nullptr>
|
||||||
hopscotch_hash(size_type bucket_count,
|
hopscotch_hash(size_type bucket_count,
|
||||||
const Hash& hash,
|
const Hash& hash,
|
||||||
const KeyEqual& equal,
|
const KeyEqual& equal,
|
||||||
@ -814,7 +814,7 @@ public:
|
|||||||
this->max_load_factor(max_load_factor);
|
this->max_load_factor(max_load_factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class OC = OverflowContainer, typename std::enable_if<has_key_compare<OC>::value>::type* = nullptr>
|
template <typename OC = OverflowContainer, typename std::enable_if<has_key_compare<OC>::value>::type* = nullptr>
|
||||||
hopscotch_hash(size_type bucket_count,
|
hopscotch_hash(size_type bucket_count,
|
||||||
const Hash& hash,
|
const Hash& hash,
|
||||||
const KeyEqual& equal,
|
const KeyEqual& equal,
|
||||||
@ -949,7 +949,7 @@ public:
|
|||||||
return insert_impl(value);
|
return insert_impl(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class P, typename std::enable_if<std::is_constructible<value_type, P&&>::value>::type* = nullptr>
|
template <typename P, typename std::enable_if<std::is_constructible<value_type, P&&>::value>::type* = nullptr>
|
||||||
std::pair<iterator, bool> insert(P&& value) {
|
std::pair<iterator, bool> insert(P&& value) {
|
||||||
return emplace(std::forward<P>(value));
|
return emplace(std::forward<P>(value));
|
||||||
}
|
}
|
||||||
@ -967,7 +967,7 @@ public:
|
|||||||
return insert(value).first;
|
return insert(value).first;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class P, typename std::enable_if<std::is_constructible<value_type, P&&>::value>::type* = nullptr>
|
template <typename P, typename std::enable_if<std::is_constructible<value_type, P&&>::value>::type* = nullptr>
|
||||||
iterator insert(const_iterator hint, P&& value) {
|
iterator insert(const_iterator hint, P&& value) {
|
||||||
return emplace_hint(hint, std::forward<P>(value));
|
return emplace_hint(hint, std::forward<P>(value));
|
||||||
}
|
}
|
||||||
@ -981,7 +981,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class InputIt>
|
template <typename InputIt>
|
||||||
void insert(InputIt first, InputIt last) {
|
void insert(InputIt first, InputIt last) {
|
||||||
if(std::is_base_of<std::forward_iterator_tag,
|
if(std::is_base_of<std::forward_iterator_tag,
|
||||||
typename std::iterator_traits<InputIt>::iterator_category>::value)
|
typename std::iterator_traits<InputIt>::iterator_category>::value)
|
||||||
@ -1003,18 +1003,18 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class M>
|
template <typename M>
|
||||||
std::pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj) {
|
std::pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj) {
|
||||||
return insert_or_assign_impl(k, std::forward<M>(obj));
|
return insert_or_assign_impl(k, std::forward<M>(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class M>
|
template <typename M>
|
||||||
std::pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj) {
|
std::pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj) {
|
||||||
return insert_or_assign_impl(std::move(k), std::forward<M>(obj));
|
return insert_or_assign_impl(std::move(k), std::forward<M>(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class M>
|
template <typename M>
|
||||||
iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj) {
|
iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj) {
|
||||||
if(hint != cend() && compare_keys(KeySelect()(*hint), k)) {
|
if(hint != cend() && compare_keys(KeySelect()(*hint), k)) {
|
||||||
auto it = mutable_iterator(hint);
|
auto it = mutable_iterator(hint);
|
||||||
@ -1026,7 +1026,7 @@ public:
|
|||||||
return insert_or_assign(k, std::forward<M>(obj)).first;
|
return insert_or_assign(k, std::forward<M>(obj)).first;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class M>
|
template <typename M>
|
||||||
iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj) {
|
iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj) {
|
||||||
if(hint != cend() && compare_keys(KeySelect()(*hint), k)) {
|
if(hint != cend() && compare_keys(KeySelect()(*hint), k)) {
|
||||||
auto it = mutable_iterator(hint);
|
auto it = mutable_iterator(hint);
|
||||||
@ -1039,27 +1039,27 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class... Args>
|
template <typename... Args>
|
||||||
std::pair<iterator, bool> emplace(Args&&... args) {
|
std::pair<iterator, bool> emplace(Args&&... args) {
|
||||||
return insert(value_type(std::forward<Args>(args)...));
|
return insert(value_type(std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class... Args>
|
template <typename... Args>
|
||||||
iterator emplace_hint(const_iterator hint, Args&&... args) {
|
iterator emplace_hint(const_iterator hint, Args&&... args) {
|
||||||
return insert(hint, value_type(std::forward<Args>(args)...));
|
return insert(hint, value_type(std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class... Args>
|
template <typename... Args>
|
||||||
std::pair<iterator, bool> try_emplace(const key_type& k, Args&&... args) {
|
std::pair<iterator, bool> try_emplace(const key_type& k, Args&&... args) {
|
||||||
return try_emplace_impl(k, std::forward<Args>(args)...);
|
return try_emplace_impl(k, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class... Args>
|
template <typename... Args>
|
||||||
std::pair<iterator, bool> try_emplace(key_type&& k, Args&&... args) {
|
std::pair<iterator, bool> try_emplace(key_type&& k, Args&&... args) {
|
||||||
return try_emplace_impl(std::move(k), std::forward<Args>(args)...);
|
return try_emplace_impl(std::move(k), std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class... Args>
|
template <typename... Args>
|
||||||
iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args) {
|
iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args) {
|
||||||
if(hint != cend() && compare_keys(KeySelect()(*hint), k)) {
|
if(hint != cend() && compare_keys(KeySelect()(*hint), k)) {
|
||||||
return mutable_iterator(hint);
|
return mutable_iterator(hint);
|
||||||
@ -1068,7 +1068,7 @@ public:
|
|||||||
return try_emplace(k, std::forward<Args>(args)...).first;
|
return try_emplace(k, std::forward<Args>(args)...).first;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class... Args>
|
template <typename... Args>
|
||||||
iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args) {
|
iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args) {
|
||||||
if(hint != cend() && compare_keys(KeySelect()(*hint), k)) {
|
if(hint != cend() && compare_keys(KeySelect()(*hint), k)) {
|
||||||
return mutable_iterator(hint);
|
return mutable_iterator(hint);
|
||||||
@ -1111,12 +1111,12 @@ public:
|
|||||||
return to_delete;
|
return to_delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class K>
|
template <typename K>
|
||||||
size_type erase(const K& key) {
|
size_type erase(const K& key) {
|
||||||
return erase(key, hash_key(key));
|
return erase(key, hash_key(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class K>
|
template <typename K>
|
||||||
size_type erase(const K& key, std::size_t hash) {
|
size_type erase(const K& key, std::size_t hash) {
|
||||||
const std::size_t ibucket_for_hash = bucket_for_hash(hash);
|
const std::size_t ibucket_for_hash = bucket_for_hash(hash);
|
||||||
|
|
||||||
@ -1157,23 +1157,23 @@ public:
|
|||||||
/*
|
/*
|
||||||
* Lookup
|
* Lookup
|
||||||
*/
|
*/
|
||||||
template<class K, class U = ValueSelect, typename std::enable_if<has_mapped_type<U>::value>::type* = nullptr>
|
template <typename K, typename U = ValueSelect, typename std::enable_if<has_mapped_type<U>::value>::type* = nullptr>
|
||||||
typename U::value_type& at(const K& key) {
|
typename U::value_type& at(const K& key) {
|
||||||
return at(key, hash_key(key));
|
return at(key, hash_key(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class K, class U = ValueSelect, typename std::enable_if<has_mapped_type<U>::value>::type* = nullptr>
|
template <typename K, typename U = ValueSelect, typename std::enable_if<has_mapped_type<U>::value>::type* = nullptr>
|
||||||
typename U::value_type& at(const K& key, std::size_t hash) {
|
typename U::value_type& at(const K& key, std::size_t hash) {
|
||||||
return const_cast<typename U::value_type&>(static_cast<const hopscotch_hash*>(this)->at(key, hash));
|
return const_cast<typename U::value_type&>(static_cast<const hopscotch_hash*>(this)->at(key, hash));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class K, class U = ValueSelect, typename std::enable_if<has_mapped_type<U>::value>::type* = nullptr>
|
template <typename K, typename U = ValueSelect, typename std::enable_if<has_mapped_type<U>::value>::type* = nullptr>
|
||||||
const typename U::value_type& at(const K& key) const {
|
const typename U::value_type& at(const K& key) const {
|
||||||
return at(key, hash_key(key));
|
return at(key, hash_key(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class K, class U = ValueSelect, typename std::enable_if<has_mapped_type<U>::value>::type* = nullptr>
|
template <typename K, typename U = ValueSelect, typename std::enable_if<has_mapped_type<U>::value>::type* = nullptr>
|
||||||
const typename U::value_type& at(const K& key, std::size_t hash) const {
|
const typename U::value_type& at(const K& key, std::size_t hash) const {
|
||||||
using T = typename U::value_type;
|
using T = typename U::value_type;
|
||||||
|
|
||||||
@ -1187,7 +1187,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class K, class U = ValueSelect, typename std::enable_if<has_mapped_type<U>::value>::type* = nullptr>
|
template <typename K, typename U = ValueSelect, typename std::enable_if<has_mapped_type<U>::value>::type* = nullptr>
|
||||||
typename U::value_type& operator[](K&& key) {
|
typename U::value_type& operator[](K&& key) {
|
||||||
using T = typename U::value_type;
|
using T = typename U::value_type;
|
||||||
|
|
||||||
@ -1206,57 +1206,57 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class K>
|
template <typename K>
|
||||||
size_type count(const K& key) const {
|
size_type count(const K& key) const {
|
||||||
return count(key, hash_key(key));
|
return count(key, hash_key(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class K>
|
template <typename K>
|
||||||
size_type count(const K& key, std::size_t hash) const {
|
size_type count(const K& key, std::size_t hash) const {
|
||||||
return count_impl(key, hash, m_buckets.cbegin() + bucket_for_hash(hash));
|
return count_impl(key, hash, m_buckets.cbegin() + bucket_for_hash(hash));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class K>
|
template <typename K>
|
||||||
iterator find(const K& key) {
|
iterator find(const K& key) {
|
||||||
return find(key, hash_key(key));
|
return find(key, hash_key(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class K>
|
template <typename K>
|
||||||
iterator find(const K& key, std::size_t hash) {
|
iterator find(const K& key, std::size_t hash) {
|
||||||
return find_impl(key, hash, m_buckets.begin() + bucket_for_hash(hash));
|
return find_impl(key, hash, m_buckets.begin() + bucket_for_hash(hash));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class K>
|
template <typename K>
|
||||||
const_iterator find(const K& key) const {
|
const_iterator find(const K& key) const {
|
||||||
return find(key, hash_key(key));
|
return find(key, hash_key(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class K>
|
template <typename K>
|
||||||
const_iterator find(const K& key, std::size_t hash) const {
|
const_iterator find(const K& key, std::size_t hash) const {
|
||||||
return find_impl(key, hash, m_buckets.begin() + bucket_for_hash(hash));
|
return find_impl(key, hash, m_buckets.begin() + bucket_for_hash(hash));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class K>
|
template <typename K>
|
||||||
std::pair<iterator, iterator> equal_range(const K& key) {
|
std::pair<iterator, iterator> equal_range(const K& key) {
|
||||||
return equal_range(key, hash_key(key));
|
return equal_range(key, hash_key(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class K>
|
template <typename K>
|
||||||
std::pair<iterator, iterator> equal_range(const K& key, std::size_t hash) {
|
std::pair<iterator, iterator> equal_range(const K& key, std::size_t hash) {
|
||||||
iterator it = find(key, hash);
|
iterator it = find(key, hash);
|
||||||
return std::make_pair(it, (it == end())?it:std::next(it));
|
return std::make_pair(it, (it == end())?it:std::next(it));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class K>
|
template <typename K>
|
||||||
std::pair<const_iterator, const_iterator> equal_range(const K& key) const {
|
std::pair<const_iterator, const_iterator> equal_range(const K& key) const {
|
||||||
return equal_range(key, hash_key(key));
|
return equal_range(key, hash_key(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class K>
|
template <typename K>
|
||||||
std::pair<const_iterator, const_iterator> equal_range(const K& key, std::size_t hash) const {
|
std::pair<const_iterator, const_iterator> equal_range(const K& key, std::size_t hash) const {
|
||||||
const_iterator it = find(key, hash);
|
const_iterator it = find(key, hash);
|
||||||
return std::make_pair(it, (it == cend())?it:std::next(it));
|
return std::make_pair(it, (it == cend())?it:std::next(it));
|
||||||
@ -1339,19 +1339,19 @@ public:
|
|||||||
return m_overflow_elements.size();
|
return m_overflow_elements.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class U = OverflowContainer, typename std::enable_if<has_key_compare<U>::value>::type* = nullptr>
|
template <typename U = OverflowContainer, typename std::enable_if<has_key_compare<U>::value>::type* = nullptr>
|
||||||
typename U::key_compare key_comp() const {
|
typename U::key_compare key_comp() const {
|
||||||
return m_overflow_elements.key_comp();
|
return m_overflow_elements.key_comp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template<class K>
|
template <typename K>
|
||||||
std::size_t hash_key(const K& key) const {
|
std::size_t hash_key(const K& key) const {
|
||||||
return Hash::operator()(key);
|
return Hash::operator()(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class K1, class K2>
|
template <typename K1, typename K2>
|
||||||
bool compare_keys(const K1& key1, const K2& key2) const {
|
bool compare_keys(const K1& key1, const K2& key2) const {
|
||||||
return KeyEqual::operator()(key1, key2);
|
return KeyEqual::operator()(key1, key2);
|
||||||
}
|
}
|
||||||
@ -1499,7 +1499,7 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class K, class M>
|
template <typename K, typename M>
|
||||||
std::pair<iterator, bool> insert_or_assign_impl(K&& key, M&& obj) {
|
std::pair<iterator, bool> insert_or_assign_impl(K&& key, M&& obj) {
|
||||||
auto it = try_emplace_impl(std::forward<K>(key), std::forward<M>(obj));
|
auto it = try_emplace_impl(std::forward<K>(key), std::forward<M>(obj));
|
||||||
if(!it.second) {
|
if(!it.second) {
|
||||||
@ -1509,7 +1509,7 @@ private:
|
|||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename P, class... Args>
|
template <typename P, typename... Args>
|
||||||
std::pair<iterator, bool> try_emplace_impl(P&& key, Args&&... args_value) {
|
std::pair<iterator, bool> try_emplace_impl(P&& key, Args&&... args_value) {
|
||||||
const std::size_t hash = hash_key(key);
|
const std::size_t hash = hash_key(key);
|
||||||
const std::size_t ibucket_for_hash = bucket_for_hash(hash);
|
const std::size_t ibucket_for_hash = bucket_for_hash(hash);
|
||||||
@ -1682,7 +1682,7 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class K, class U = ValueSelect, typename std::enable_if<has_mapped_type<U>::value>::type* = nullptr>
|
template <typename K, typename U = ValueSelect, typename std::enable_if<has_mapped_type<U>::value>::type* = nullptr>
|
||||||
typename U::value_type* find_value_impl(const K& key, std::size_t hash, iterator_buckets it_bucket) {
|
typename U::value_type* find_value_impl(const K& key, std::size_t hash, iterator_buckets it_bucket) {
|
||||||
return const_cast<typename U::value_type*>(
|
return const_cast<typename U::value_type*>(
|
||||||
static_cast<const hopscotch_hash*>(this)->find_value_impl(key, hash, it_bucket));
|
static_cast<const hopscotch_hash*>(this)->find_value_impl(key, hash, it_bucket));
|
||||||
@ -1693,7 +1693,7 @@ private:
|
|||||||
*
|
*
|
||||||
* Return null if no value for key (TODO use std::optional when available).
|
* Return null if no value for key (TODO use std::optional when available).
|
||||||
*/
|
*/
|
||||||
template<class K, class U = ValueSelect, typename std::enable_if<has_mapped_type<U>::value>::type* = nullptr>
|
template <typename K, typename U = ValueSelect, typename std::enable_if<has_mapped_type<U>::value>::type* = nullptr>
|
||||||
const typename U::value_type* find_value_impl(const K& key, std::size_t hash,
|
const typename U::value_type* find_value_impl(const K& key, std::size_t hash,
|
||||||
const_iterator_buckets it_bucket) const
|
const_iterator_buckets it_bucket) const
|
||||||
{
|
{
|
||||||
@ -1712,7 +1712,7 @@ private:
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class K>
|
template <typename K>
|
||||||
size_type count_impl(const K& key, std::size_t hash, const_iterator_buckets it_bucket) const {
|
size_type count_impl(const K& key, std::size_t hash, const_iterator_buckets it_bucket) const {
|
||||||
if(find_in_buckets(key, hash, it_bucket) != m_buckets.cend()) {
|
if(find_in_buckets(key, hash, it_bucket) != m_buckets.cend()) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -1725,7 +1725,7 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class K>
|
template <typename K>
|
||||||
iterator find_impl(const K& key, std::size_t hash, iterator_buckets it_bucket) {
|
iterator find_impl(const K& key, std::size_t hash, iterator_buckets it_bucket) {
|
||||||
auto it = find_in_buckets(key, hash, it_bucket);
|
auto it = find_in_buckets(key, hash, it_bucket);
|
||||||
if(it != m_buckets.end()) {
|
if(it != m_buckets.end()) {
|
||||||
@ -1739,7 +1739,7 @@ private:
|
|||||||
return iterator(m_buckets.end(), m_buckets.end(), find_in_overflow(key));
|
return iterator(m_buckets.end(), m_buckets.end(), find_in_overflow(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class K>
|
template <typename K>
|
||||||
const_iterator find_impl(const K& key, std::size_t hash, const_iterator_buckets it_bucket) const {
|
const_iterator find_impl(const K& key, std::size_t hash, const_iterator_buckets it_bucket) const {
|
||||||
auto it = find_in_buckets(key, hash, it_bucket);
|
auto it = find_in_buckets(key, hash, it_bucket);
|
||||||
if(it != m_buckets.cend()) {
|
if(it != m_buckets.cend()) {
|
||||||
@ -1754,14 +1754,14 @@ private:
|
|||||||
return const_iterator(m_buckets.cend(), m_buckets.cend(), find_in_overflow(key));
|
return const_iterator(m_buckets.cend(), m_buckets.cend(), find_in_overflow(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class K>
|
template <typename K>
|
||||||
iterator_buckets find_in_buckets(const K& key, std::size_t hash, iterator_buckets it_bucket) {
|
iterator_buckets find_in_buckets(const K& key, std::size_t hash, iterator_buckets it_bucket) {
|
||||||
auto it_find = static_cast<const hopscotch_hash*>(this)->find_in_buckets(key, hash, it_bucket);
|
auto it_find = static_cast<const hopscotch_hash*>(this)->find_in_buckets(key, hash, it_bucket);
|
||||||
return m_buckets.begin() + std::distance(m_buckets.cbegin(), it_find);
|
return m_buckets.begin() + std::distance(m_buckets.cbegin(), it_find);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class K>
|
template <typename K>
|
||||||
const_iterator_buckets find_in_buckets(const K& key, std::size_t hash, const_iterator_buckets it_bucket) const {
|
const_iterator_buckets find_in_buckets(const K& key, std::size_t hash, const_iterator_buckets it_bucket) const {
|
||||||
(void) hash; // Avoid warning of unused variable when StoreHash is false;
|
(void) hash; // Avoid warning of unused variable when StoreHash is false;
|
||||||
|
|
||||||
@ -1791,7 +1791,7 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class K, class U = OverflowContainer, typename std::enable_if<!has_key_compare<U>::value>::type* = nullptr>
|
template <typename K, typename U = OverflowContainer, typename std::enable_if<!has_key_compare<U>::value>::type* = nullptr>
|
||||||
iterator_overflow find_in_overflow(const K& key) {
|
iterator_overflow find_in_overflow(const K& key) {
|
||||||
return std::find_if(m_overflow_elements.begin(), m_overflow_elements.end(),
|
return std::find_if(m_overflow_elements.begin(), m_overflow_elements.end(),
|
||||||
[&](const value_type& value) {
|
[&](const value_type& value) {
|
||||||
@ -1799,7 +1799,7 @@ private:
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class K, class U = OverflowContainer, typename std::enable_if<!has_key_compare<U>::value>::type* = nullptr>
|
template <typename K, typename U = OverflowContainer, typename std::enable_if<!has_key_compare<U>::value>::type* = nullptr>
|
||||||
const_iterator_overflow find_in_overflow(const K& key) const {
|
const_iterator_overflow find_in_overflow(const K& key) const {
|
||||||
return std::find_if(m_overflow_elements.cbegin(), m_overflow_elements.cend(),
|
return std::find_if(m_overflow_elements.cbegin(), m_overflow_elements.cend(),
|
||||||
[&](const value_type& value) {
|
[&](const value_type& value) {
|
||||||
@ -1807,37 +1807,37 @@ private:
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class K, class U = OverflowContainer, typename std::enable_if<has_key_compare<U>::value>::type* = nullptr>
|
template <typename K, typename U = OverflowContainer, typename std::enable_if<has_key_compare<U>::value>::type* = nullptr>
|
||||||
iterator_overflow find_in_overflow(const K& key) {
|
iterator_overflow find_in_overflow(const K& key) {
|
||||||
return m_overflow_elements.find(key);
|
return m_overflow_elements.find(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class K, class U = OverflowContainer, typename std::enable_if<has_key_compare<U>::value>::type* = nullptr>
|
template <typename K, typename U = OverflowContainer, typename std::enable_if<has_key_compare<U>::value>::type* = nullptr>
|
||||||
const_iterator_overflow find_in_overflow(const K& key) const {
|
const_iterator_overflow find_in_overflow(const K& key) const {
|
||||||
return m_overflow_elements.find(key);
|
return m_overflow_elements.find(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class... Args, class U = OverflowContainer, typename std::enable_if<!has_key_compare<U>::value>::type* = nullptr>
|
template <typename... Args, typename U = OverflowContainer, typename std::enable_if<!has_key_compare<U>::value>::type* = nullptr>
|
||||||
iterator_overflow insert_in_overflow(Args&&... value_type_args) {
|
iterator_overflow insert_in_overflow(Args&&... value_type_args) {
|
||||||
return m_overflow_elements.emplace(m_overflow_elements.end(), std::forward<Args>(value_type_args)...);
|
return m_overflow_elements.emplace(m_overflow_elements.end(), std::forward<Args>(value_type_args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class... Args, class U = OverflowContainer, typename std::enable_if<has_key_compare<U>::value>::type* = nullptr>
|
template <typename... Args, typename U = OverflowContainer, typename std::enable_if<has_key_compare<U>::value>::type* = nullptr>
|
||||||
iterator_overflow insert_in_overflow(Args&&... value_type_args) {
|
iterator_overflow insert_in_overflow(Args&&... value_type_args) {
|
||||||
return m_overflow_elements.emplace(std::forward<Args>(value_type_args)...).first;
|
return m_overflow_elements.emplace(std::forward<Args>(value_type_args)...).first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class U = OverflowContainer, typename std::enable_if<!has_key_compare<U>::value>::type* = nullptr>
|
template <typename U = OverflowContainer, typename std::enable_if<!has_key_compare<U>::value>::type* = nullptr>
|
||||||
hopscotch_hash new_hopscotch_hash(size_type bucket_count) {
|
hopscotch_hash new_hopscotch_hash(size_type bucket_count) {
|
||||||
return hopscotch_hash(bucket_count, static_cast<Hash&>(*this), static_cast<KeyEqual&>(*this),
|
return hopscotch_hash(bucket_count, static_cast<Hash&>(*this), static_cast<KeyEqual&>(*this),
|
||||||
get_allocator(), m_max_load_factor);
|
get_allocator(), m_max_load_factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class U = OverflowContainer, typename std::enable_if<has_key_compare<U>::value>::type* = nullptr>
|
template <typename U = OverflowContainer, typename std::enable_if<has_key_compare<U>::value>::type* = nullptr>
|
||||||
hopscotch_hash new_hopscotch_hash(size_type bucket_count) {
|
hopscotch_hash new_hopscotch_hash(size_type bucket_count) {
|
||||||
return hopscotch_hash(bucket_count, static_cast<Hash&>(*this), static_cast<KeyEqual&>(*this),
|
return hopscotch_hash(bucket_count, static_cast<Hash&>(*this), static_cast<KeyEqual&>(*this),
|
||||||
get_allocator(), m_max_load_factor, m_overflow_elements.key_comp());
|
get_allocator(), m_max_load_factor, m_overflow_elements.key_comp());
|
||||||
|
@ -68,7 +68,7 @@ namespace tsl {
|
|||||||
* insert will invalidate the iterators). Or if there is a rehash.
|
* insert will invalidate the iterators). Or if there is a rehash.
|
||||||
* - erase: iterator on the erased element is the only one which become invalid.
|
* - erase: iterator on the erased element is the only one which become invalid.
|
||||||
*/
|
*/
|
||||||
template<class Key,
|
template <typename Key,
|
||||||
class T,
|
class T,
|
||||||
class Hash = std::hash<Key>,
|
class Hash = std::hash<Key>,
|
||||||
class KeyEqual = std::equal_to<Key>,
|
class KeyEqual = std::equal_to<Key>,
|
||||||
@ -161,7 +161,7 @@ public:
|
|||||||
explicit hopscotch_map(const Allocator& alloc) : hopscotch_map(ht::DEFAULT_INIT_BUCKETS_SIZE, alloc) {
|
explicit hopscotch_map(const Allocator& alloc) : hopscotch_map(ht::DEFAULT_INIT_BUCKETS_SIZE, alloc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class InputIt>
|
template <typename InputIt>
|
||||||
hopscotch_map(InputIt first, InputIt last,
|
hopscotch_map(InputIt first, InputIt last,
|
||||||
size_type bucket_count = ht::DEFAULT_INIT_BUCKETS_SIZE,
|
size_type bucket_count = ht::DEFAULT_INIT_BUCKETS_SIZE,
|
||||||
const Hash& hash = Hash(),
|
const Hash& hash = Hash(),
|
||||||
@ -171,14 +171,14 @@ public:
|
|||||||
insert(first, last);
|
insert(first, last);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class InputIt>
|
template <typename InputIt>
|
||||||
hopscotch_map(InputIt first, InputIt last,
|
hopscotch_map(InputIt first, InputIt last,
|
||||||
size_type bucket_count,
|
size_type bucket_count,
|
||||||
const Allocator& alloc) : hopscotch_map(first, last, bucket_count, Hash(), KeyEqual(), alloc)
|
const Allocator& alloc) : hopscotch_map(first, last, bucket_count, Hash(), KeyEqual(), alloc)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class InputIt>
|
template <typename InputIt>
|
||||||
hopscotch_map(InputIt first, InputIt last,
|
hopscotch_map(InputIt first, InputIt last,
|
||||||
size_type bucket_count,
|
size_type bucket_count,
|
||||||
const Hash& hash,
|
const Hash& hash,
|
||||||
@ -254,7 +254,7 @@ public:
|
|||||||
return m_ht.insert(value);
|
return m_ht.insert(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class P, typename std::enable_if<std::is_constructible<value_type, P&&>::value>::type* = nullptr>
|
template <typename P, typename std::enable_if<std::is_constructible<value_type, P&&>::value>::type* = nullptr>
|
||||||
std::pair<iterator, bool> insert(P&& value) {
|
std::pair<iterator, bool> insert(P&& value) {
|
||||||
return m_ht.insert(std::forward<P>(value));
|
return m_ht.insert(std::forward<P>(value));
|
||||||
}
|
}
|
||||||
@ -268,7 +268,7 @@ public:
|
|||||||
return m_ht.insert(hint, value);
|
return m_ht.insert(hint, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class P, typename std::enable_if<std::is_constructible<value_type, P&&>::value>::type* = nullptr>
|
template <typename P, typename std::enable_if<std::is_constructible<value_type, P&&>::value>::type* = nullptr>
|
||||||
iterator insert(const_iterator hint, P&& value) {
|
iterator insert(const_iterator hint, P&& value) {
|
||||||
return m_ht.insert(hint, std::forward<P>(value));
|
return m_ht.insert(hint, std::forward<P>(value));
|
||||||
}
|
}
|
||||||
@ -278,7 +278,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class InputIt>
|
template <typename InputIt>
|
||||||
void insert(InputIt first, InputIt last) {
|
void insert(InputIt first, InputIt last) {
|
||||||
m_ht.insert(first, last);
|
m_ht.insert(first, last);
|
||||||
}
|
}
|
||||||
@ -290,22 +290,22 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class M>
|
template <typename M>
|
||||||
std::pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj) {
|
std::pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj) {
|
||||||
return m_ht.insert_or_assign(k, std::forward<M>(obj));
|
return m_ht.insert_or_assign(k, std::forward<M>(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class M>
|
template <typename M>
|
||||||
std::pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj) {
|
std::pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj) {
|
||||||
return m_ht.insert_or_assign(std::move(k), std::forward<M>(obj));
|
return m_ht.insert_or_assign(std::move(k), std::forward<M>(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class M>
|
template <typename M>
|
||||||
iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj) {
|
iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj) {
|
||||||
return m_ht.insert_or_assign(hint, k, std::forward<M>(obj));
|
return m_ht.insert_or_assign(hint, k, std::forward<M>(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class M>
|
template <typename M>
|
||||||
iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj) {
|
iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj) {
|
||||||
return m_ht.insert_or_assign(hint, std::move(k), std::forward<M>(obj));
|
return m_ht.insert_or_assign(hint, std::move(k), std::forward<M>(obj));
|
||||||
}
|
}
|
||||||
@ -319,7 +319,7 @@ public:
|
|||||||
*
|
*
|
||||||
* Mainly here for compatibility with the std::unordered_map interface.
|
* Mainly here for compatibility with the std::unordered_map interface.
|
||||||
*/
|
*/
|
||||||
template<class... Args>
|
template <typename... Args>
|
||||||
std::pair<iterator, bool> emplace(Args&&... args) {
|
std::pair<iterator, bool> emplace(Args&&... args) {
|
||||||
return m_ht.emplace(std::forward<Args>(args)...);
|
return m_ht.emplace(std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
@ -333,7 +333,7 @@ public:
|
|||||||
*
|
*
|
||||||
* Mainly here for compatibility with the std::unordered_map interface.
|
* Mainly here for compatibility with the std::unordered_map interface.
|
||||||
*/
|
*/
|
||||||
template<class... Args>
|
template <typename... Args>
|
||||||
iterator emplace_hint(const_iterator hint, Args&&... args) {
|
iterator emplace_hint(const_iterator hint, Args&&... args) {
|
||||||
return m_ht.emplace_hint(hint, std::forward<Args>(args)...);
|
return m_ht.emplace_hint(hint, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
@ -341,22 +341,22 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class... Args>
|
template <typename... Args>
|
||||||
std::pair<iterator, bool> try_emplace(const key_type& k, Args&&... args) {
|
std::pair<iterator, bool> try_emplace(const key_type& k, Args&&... args) {
|
||||||
return m_ht.try_emplace(k, std::forward<Args>(args)...);
|
return m_ht.try_emplace(k, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class... Args>
|
template <typename... Args>
|
||||||
std::pair<iterator, bool> try_emplace(key_type&& k, Args&&... args) {
|
std::pair<iterator, bool> try_emplace(key_type&& k, Args&&... args) {
|
||||||
return m_ht.try_emplace(std::move(k), std::forward<Args>(args)...);
|
return m_ht.try_emplace(std::move(k), std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class... Args>
|
template <typename... Args>
|
||||||
iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args) {
|
iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args) {
|
||||||
return m_ht.try_emplace(hint, k, std::forward<Args>(args)...);
|
return m_ht.try_emplace(hint, k, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class... Args>
|
template <typename... Args>
|
||||||
iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args) {
|
iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args) {
|
||||||
return m_ht.try_emplace(hint, std::move(k), std::forward<Args>(args)...);
|
return m_ht.try_emplace(hint, std::move(k), std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
@ -381,7 +381,7 @@ public:
|
|||||||
* This overload only participates in the overload resolution if the typedef KeyEqual::is_transparent exists.
|
* This overload only participates in the overload resolution if the typedef KeyEqual::is_transparent exists.
|
||||||
* If so, K must be hashable and comparable to Key.
|
* If so, K must be hashable and comparable to Key.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
size_type erase(const K& key) { return m_ht.erase(key); }
|
size_type erase(const K& key) { return m_ht.erase(key); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -390,7 +390,7 @@ public:
|
|||||||
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
||||||
* as hash_function()(key). Usefull to speed-up the lookup to the value if you already have the hash.
|
* as hash_function()(key). Usefull to speed-up the lookup to the value if you already have the hash.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
size_type erase(const K& key, std::size_t precalculated_hash) {
|
size_type erase(const K& key, std::size_t precalculated_hash) {
|
||||||
return m_ht.erase(key, precalculated_hash);
|
return m_ht.erase(key, precalculated_hash);
|
||||||
}
|
}
|
||||||
@ -424,7 +424,7 @@ public:
|
|||||||
* This overload only participates in the overload resolution if the typedef KeyEqual::is_transparent exists.
|
* This overload only participates in the overload resolution if the typedef KeyEqual::is_transparent exists.
|
||||||
* If so, K must be hashable and comparable to Key.
|
* If so, K must be hashable and comparable to Key.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
T& at(const K& key) { return m_ht.at(key); }
|
T& at(const K& key) { return m_ht.at(key); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -433,20 +433,20 @@ public:
|
|||||||
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
||||||
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
T& at(const K& key, std::size_t precalculated_hash) { return m_ht.at(key, precalculated_hash); }
|
T& at(const K& key, std::size_t precalculated_hash) { return m_ht.at(key, precalculated_hash); }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copydoc at(const K& key)
|
* @copydoc at(const K& key)
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
const T& at(const K& key) const { return m_ht.at(key); }
|
const T& at(const K& key) const { return m_ht.at(key); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copydoc at(const K& key, std::size_t precalculated_hash)
|
* @copydoc at(const K& key, std::size_t precalculated_hash)
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
const T& at(const K& key, std::size_t precalculated_hash) const { return m_ht.at(key, precalculated_hash); }
|
const T& at(const K& key, std::size_t precalculated_hash) const { return m_ht.at(key, precalculated_hash); }
|
||||||
|
|
||||||
|
|
||||||
@ -472,7 +472,7 @@ public:
|
|||||||
* This overload only participates in the overload resolution if the typedef KeyEqual::is_transparent exists.
|
* This overload only participates in the overload resolution if the typedef KeyEqual::is_transparent exists.
|
||||||
* If so, K must be hashable and comparable to Key.
|
* If so, K must be hashable and comparable to Key.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
size_type count(const K& key) const { return m_ht.count(key); }
|
size_type count(const K& key) const { return m_ht.count(key); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -481,7 +481,7 @@ public:
|
|||||||
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
||||||
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
size_type count(const K& key, std::size_t precalculated_hash) const { return m_ht.count(key, precalculated_hash); }
|
size_type count(const K& key, std::size_t precalculated_hash) const { return m_ht.count(key, precalculated_hash); }
|
||||||
|
|
||||||
|
|
||||||
@ -508,7 +508,7 @@ public:
|
|||||||
* This overload only participates in the overload resolution if the typedef KeyEqual::is_transparent exists.
|
* This overload only participates in the overload resolution if the typedef KeyEqual::is_transparent exists.
|
||||||
* If so, K must be hashable and comparable to Key.
|
* If so, K must be hashable and comparable to Key.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
iterator find(const K& key) { return m_ht.find(key); }
|
iterator find(const K& key) { return m_ht.find(key); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -517,13 +517,13 @@ public:
|
|||||||
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
||||||
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
iterator find(const K& key, std::size_t precalculated_hash) { return m_ht.find(key, precalculated_hash); }
|
iterator find(const K& key, std::size_t precalculated_hash) { return m_ht.find(key, precalculated_hash); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copydoc find(const K& key)
|
* @copydoc find(const K& key)
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
const_iterator find(const K& key) const { return m_ht.find(key); }
|
const_iterator find(const K& key) const { return m_ht.find(key); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -532,7 +532,7 @@ public:
|
|||||||
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
||||||
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
const_iterator find(const K& key, std::size_t precalculated_hash) const {
|
const_iterator find(const K& key, std::size_t precalculated_hash) const {
|
||||||
return m_ht.find(key, precalculated_hash);
|
return m_ht.find(key, precalculated_hash);
|
||||||
}
|
}
|
||||||
@ -563,7 +563,7 @@ public:
|
|||||||
* This overload only participates in the overload resolution if the typedef KeyEqual::is_transparent exists.
|
* This overload only participates in the overload resolution if the typedef KeyEqual::is_transparent exists.
|
||||||
* If so, K must be hashable and comparable to Key.
|
* If so, K must be hashable and comparable to Key.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
std::pair<iterator, iterator> equal_range(const K& key) { return m_ht.equal_range(key); }
|
std::pair<iterator, iterator> equal_range(const K& key) { return m_ht.equal_range(key); }
|
||||||
|
|
||||||
|
|
||||||
@ -573,7 +573,7 @@ public:
|
|||||||
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
||||||
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
std::pair<iterator, iterator> equal_range(const K& key, std::size_t precalculated_hash) {
|
std::pair<iterator, iterator> equal_range(const K& key, std::size_t precalculated_hash) {
|
||||||
return m_ht.equal_range(key, precalculated_hash);
|
return m_ht.equal_range(key, precalculated_hash);
|
||||||
}
|
}
|
||||||
@ -581,13 +581,13 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @copydoc equal_range(const K& key)
|
* @copydoc equal_range(const K& key)
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
std::pair<const_iterator, const_iterator> equal_range(const K& key) const { return m_ht.equal_range(key); }
|
std::pair<const_iterator, const_iterator> equal_range(const K& key) const { return m_ht.equal_range(key); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copydoc equal_range(const K& key, std::size_t precalculated_hash)
|
* @copydoc equal_range(const K& key, std::size_t precalculated_hash)
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
std::pair<const_iterator, const_iterator> equal_range(const K& key, std::size_t precalculated_hash) const {
|
std::pair<const_iterator, const_iterator> equal_range(const K& key, std::size_t precalculated_hash) const {
|
||||||
return m_ht.equal_range(key, precalculated_hash);
|
return m_ht.equal_range(key, precalculated_hash);
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ namespace tsl {
|
|||||||
*
|
*
|
||||||
* @copydoc hopscotch_map
|
* @copydoc hopscotch_map
|
||||||
*/
|
*/
|
||||||
template<class Key,
|
template <typename Key,
|
||||||
class T,
|
class T,
|
||||||
class Hash = std::hash<Key>,
|
class Hash = std::hash<Key>,
|
||||||
class KeyEqual = std::equal_to<Key>,
|
class KeyEqual = std::equal_to<Key>,
|
||||||
@ -150,7 +150,7 @@ public:
|
|||||||
explicit hopscotch_sc_map(const Allocator& alloc) : hopscotch_sc_map(ht::DEFAULT_INIT_BUCKETS_SIZE, alloc) {
|
explicit hopscotch_sc_map(const Allocator& alloc) : hopscotch_sc_map(ht::DEFAULT_INIT_BUCKETS_SIZE, alloc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class InputIt>
|
template <typename InputIt>
|
||||||
hopscotch_sc_map(InputIt first, InputIt last,
|
hopscotch_sc_map(InputIt first, InputIt last,
|
||||||
size_type bucket_count = ht::DEFAULT_INIT_BUCKETS_SIZE,
|
size_type bucket_count = ht::DEFAULT_INIT_BUCKETS_SIZE,
|
||||||
const Hash& hash = Hash(),
|
const Hash& hash = Hash(),
|
||||||
@ -160,14 +160,14 @@ public:
|
|||||||
insert(first, last);
|
insert(first, last);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class InputIt>
|
template <typename InputIt>
|
||||||
hopscotch_sc_map(InputIt first, InputIt last,
|
hopscotch_sc_map(InputIt first, InputIt last,
|
||||||
size_type bucket_count,
|
size_type bucket_count,
|
||||||
const Allocator& alloc) : hopscotch_sc_map(first, last, bucket_count, Hash(), KeyEqual(), alloc)
|
const Allocator& alloc) : hopscotch_sc_map(first, last, bucket_count, Hash(), KeyEqual(), alloc)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class InputIt>
|
template <typename InputIt>
|
||||||
hopscotch_sc_map(InputIt first, InputIt last,
|
hopscotch_sc_map(InputIt first, InputIt last,
|
||||||
size_type bucket_count,
|
size_type bucket_count,
|
||||||
const Hash& hash,
|
const Hash& hash,
|
||||||
@ -243,7 +243,7 @@ public:
|
|||||||
return m_ht.insert(value);
|
return m_ht.insert(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class P, typename std::enable_if<std::is_constructible<value_type, P&&>::value>::type* = nullptr>
|
template <typename P, typename std::enable_if<std::is_constructible<value_type, P&&>::value>::type* = nullptr>
|
||||||
std::pair<iterator, bool> insert(P&& value) {
|
std::pair<iterator, bool> insert(P&& value) {
|
||||||
return m_ht.insert(std::forward<P>(value));
|
return m_ht.insert(std::forward<P>(value));
|
||||||
}
|
}
|
||||||
@ -257,7 +257,7 @@ public:
|
|||||||
return m_ht.insert(hint, value);
|
return m_ht.insert(hint, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class P, typename std::enable_if<std::is_constructible<value_type, P&&>::value>::type* = nullptr>
|
template <typename P, typename std::enable_if<std::is_constructible<value_type, P&&>::value>::type* = nullptr>
|
||||||
iterator insert(const_iterator hint, P&& value) {
|
iterator insert(const_iterator hint, P&& value) {
|
||||||
return m_ht.insert(hint, std::forward<P>(value));
|
return m_ht.insert(hint, std::forward<P>(value));
|
||||||
}
|
}
|
||||||
@ -267,7 +267,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class InputIt>
|
template <typename InputIt>
|
||||||
void insert(InputIt first, InputIt last) {
|
void insert(InputIt first, InputIt last) {
|
||||||
m_ht.insert(first, last);
|
m_ht.insert(first, last);
|
||||||
}
|
}
|
||||||
@ -279,22 +279,22 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class M>
|
template <typename M>
|
||||||
std::pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj) {
|
std::pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj) {
|
||||||
return m_ht.insert_or_assign(k, std::forward<M>(obj));
|
return m_ht.insert_or_assign(k, std::forward<M>(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class M>
|
template <typename M>
|
||||||
std::pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj) {
|
std::pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj) {
|
||||||
return m_ht.insert_or_assign(std::move(k), std::forward<M>(obj));
|
return m_ht.insert_or_assign(std::move(k), std::forward<M>(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class M>
|
template <typename M>
|
||||||
iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj) {
|
iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj) {
|
||||||
return m_ht.insert_or_assign(hint, k, std::forward<M>(obj));
|
return m_ht.insert_or_assign(hint, k, std::forward<M>(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class M>
|
template <typename M>
|
||||||
iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj) {
|
iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj) {
|
||||||
return m_ht.insert_or_assign(hint, std::move(k), std::forward<M>(obj));
|
return m_ht.insert_or_assign(hint, std::move(k), std::forward<M>(obj));
|
||||||
}
|
}
|
||||||
@ -307,7 +307,7 @@ public:
|
|||||||
*
|
*
|
||||||
* Mainly here for compatibility with the std::unordered_map interface.
|
* Mainly here for compatibility with the std::unordered_map interface.
|
||||||
*/
|
*/
|
||||||
template<class... Args>
|
template <typename... Args>
|
||||||
std::pair<iterator, bool> emplace(Args&&... args) {
|
std::pair<iterator, bool> emplace(Args&&... args) {
|
||||||
return m_ht.emplace(std::forward<Args>(args)...);
|
return m_ht.emplace(std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
@ -321,7 +321,7 @@ public:
|
|||||||
*
|
*
|
||||||
* Mainly here for compatibility with the std::unordered_map interface.
|
* Mainly here for compatibility with the std::unordered_map interface.
|
||||||
*/
|
*/
|
||||||
template<class... Args>
|
template <typename... Args>
|
||||||
iterator emplace_hint(const_iterator hint, Args&&... args) {
|
iterator emplace_hint(const_iterator hint, Args&&... args) {
|
||||||
return m_ht.emplace_hint(hint, std::forward<Args>(args)...);
|
return m_ht.emplace_hint(hint, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
@ -329,22 +329,22 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class... Args>
|
template <typename... Args>
|
||||||
std::pair<iterator, bool> try_emplace(const key_type& k, Args&&... args) {
|
std::pair<iterator, bool> try_emplace(const key_type& k, Args&&... args) {
|
||||||
return m_ht.try_emplace(k, std::forward<Args>(args)...);
|
return m_ht.try_emplace(k, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class... Args>
|
template <typename... Args>
|
||||||
std::pair<iterator, bool> try_emplace(key_type&& k, Args&&... args) {
|
std::pair<iterator, bool> try_emplace(key_type&& k, Args&&... args) {
|
||||||
return m_ht.try_emplace(std::move(k), std::forward<Args>(args)...);
|
return m_ht.try_emplace(std::move(k), std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class... Args>
|
template <typename... Args>
|
||||||
iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args) {
|
iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args) {
|
||||||
return m_ht.try_emplace(hint, k, std::forward<Args>(args)...);
|
return m_ht.try_emplace(hint, k, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class... Args>
|
template <typename... Args>
|
||||||
iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args) {
|
iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args) {
|
||||||
return m_ht.try_emplace(hint, std::move(k), std::forward<Args>(args)...);
|
return m_ht.try_emplace(hint, std::move(k), std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
@ -370,7 +370,7 @@ public:
|
|||||||
* and Compare::is_transparent exist.
|
* and Compare::is_transparent exist.
|
||||||
* If so, K must be hashable and comparable to Key.
|
* If so, K must be hashable and comparable to Key.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
size_type erase(const K& key) { return m_ht.erase(key); }
|
size_type erase(const K& key) { return m_ht.erase(key); }
|
||||||
|
|
||||||
@ -380,7 +380,7 @@ public:
|
|||||||
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
||||||
* as hash_function()(key). Usefull to speed-up the lookup to the value if you already have the hash.
|
* as hash_function()(key). Usefull to speed-up the lookup to the value if you already have the hash.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
size_type erase(const K& key, std::size_t precalculated_hash) { return m_ht.erase(key, precalculated_hash); }
|
size_type erase(const K& key, std::size_t precalculated_hash) { return m_ht.erase(key, precalculated_hash); }
|
||||||
|
|
||||||
@ -412,7 +412,7 @@ public:
|
|||||||
* and Compare::is_transparent exist.
|
* and Compare::is_transparent exist.
|
||||||
* If so, K must be hashable and comparable to Key.
|
* If so, K must be hashable and comparable to Key.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
T& at(const K& key) { return m_ht.at(key); }
|
T& at(const K& key) { return m_ht.at(key); }
|
||||||
|
|
||||||
@ -422,21 +422,21 @@ public:
|
|||||||
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
||||||
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
T& at(const K& key, std::size_t precalculated_hash) { return m_ht.at(key, precalculated_hash); }
|
T& at(const K& key, std::size_t precalculated_hash) { return m_ht.at(key, precalculated_hash); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copydoc at(const K& key)
|
* @copydoc at(const K& key)
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
const T& at(const K& key) const { return m_ht.at(key); }
|
const T& at(const K& key) const { return m_ht.at(key); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copydoc at(const K& key, std::size_t precalculated_hash)
|
* @copydoc at(const K& key, std::size_t precalculated_hash)
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
const T& at(const K& key, std::size_t precalculated_hash) const { return m_ht.at(key, precalculated_hash); }
|
const T& at(const K& key, std::size_t precalculated_hash) const { return m_ht.at(key, precalculated_hash); }
|
||||||
|
|
||||||
@ -462,7 +462,7 @@ public:
|
|||||||
* and Compare::is_transparent exist.
|
* and Compare::is_transparent exist.
|
||||||
* If so, K must be hashable and comparable to Key.
|
* If so, K must be hashable and comparable to Key.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
size_type count(const K& key) const { return m_ht.count(key); }
|
size_type count(const K& key) const { return m_ht.count(key); }
|
||||||
|
|
||||||
@ -472,7 +472,7 @@ public:
|
|||||||
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
||||||
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
size_type count(const K& key, std::size_t precalculated_hash) const { return m_ht.count(key, precalculated_hash); }
|
size_type count(const K& key, std::size_t precalculated_hash) const { return m_ht.count(key, precalculated_hash); }
|
||||||
|
|
||||||
@ -499,7 +499,7 @@ public:
|
|||||||
* and Compare::is_transparent exist.
|
* and Compare::is_transparent exist.
|
||||||
* If so, K must be hashable and comparable to Key.
|
* If so, K must be hashable and comparable to Key.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
iterator find(const K& key) { return m_ht.find(key); }
|
iterator find(const K& key) { return m_ht.find(key); }
|
||||||
|
|
||||||
@ -509,21 +509,21 @@ public:
|
|||||||
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
||||||
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
iterator find(const K& key, std::size_t precalculated_hash) { return m_ht.find(key, precalculated_hash); }
|
iterator find(const K& key, std::size_t precalculated_hash) { return m_ht.find(key, precalculated_hash); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copydoc find(const K& key)
|
* @copydoc find(const K& key)
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
const_iterator find(const K& key) const { return m_ht.find(key); }
|
const_iterator find(const K& key) const { return m_ht.find(key); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copydoc find(const K& key, std::size_t precalculated_hash)
|
* @copydoc find(const K& key, std::size_t precalculated_hash)
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
const_iterator find(const K& key, std::size_t precalculated_hash) const { return m_ht.find(key, precalculated_hash); }
|
const_iterator find(const K& key, std::size_t precalculated_hash) const { return m_ht.find(key, precalculated_hash); }
|
||||||
|
|
||||||
@ -554,7 +554,7 @@ public:
|
|||||||
* and Compare::is_transparent exist.
|
* and Compare::is_transparent exist.
|
||||||
* If so, K must be hashable and comparable to Key.
|
* If so, K must be hashable and comparable to Key.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
std::pair<iterator, iterator> equal_range(const K& key) { return m_ht.equal_range(key); }
|
std::pair<iterator, iterator> equal_range(const K& key) { return m_ht.equal_range(key); }
|
||||||
|
|
||||||
@ -564,7 +564,7 @@ public:
|
|||||||
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
||||||
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
std::pair<iterator, iterator> equal_range(const K& key, std::size_t precalculated_hash) {
|
std::pair<iterator, iterator> equal_range(const K& key, std::size_t precalculated_hash) {
|
||||||
return m_ht.equal_range(key, precalculated_hash);
|
return m_ht.equal_range(key, precalculated_hash);
|
||||||
@ -573,14 +573,14 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @copydoc equal_range(const K& key)
|
* @copydoc equal_range(const K& key)
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
std::pair<const_iterator, const_iterator> equal_range(const K& key) const { return m_ht.equal_range(key); }
|
std::pair<const_iterator, const_iterator> equal_range(const K& key) const { return m_ht.equal_range(key); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copydoc equal_range(const K& key, std::size_t precalculated_hash)
|
* @copydoc equal_range(const K& key, std::size_t precalculated_hash)
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
std::pair<const_iterator, const_iterator> equal_range(const K& key, std::size_t precalculated_hash) const {
|
std::pair<const_iterator, const_iterator> equal_range(const K& key, std::size_t precalculated_hash) const {
|
||||||
return m_ht.equal_range(key, precalculated_hash);
|
return m_ht.equal_range(key, precalculated_hash);
|
||||||
|
@ -53,7 +53,7 @@ namespace tsl {
|
|||||||
*
|
*
|
||||||
* @copydoc hopscotch_set
|
* @copydoc hopscotch_set
|
||||||
*/
|
*/
|
||||||
template<class Key,
|
template <typename Key,
|
||||||
class Hash = std::hash<Key>,
|
class Hash = std::hash<Key>,
|
||||||
class KeyEqual = std::equal_to<Key>,
|
class KeyEqual = std::equal_to<Key>,
|
||||||
class Compare = std::less<Key>,
|
class Compare = std::less<Key>,
|
||||||
@ -133,7 +133,7 @@ public:
|
|||||||
explicit hopscotch_sc_set(const Allocator& alloc) : hopscotch_sc_set(ht::DEFAULT_INIT_BUCKETS_SIZE, alloc) {
|
explicit hopscotch_sc_set(const Allocator& alloc) : hopscotch_sc_set(ht::DEFAULT_INIT_BUCKETS_SIZE, alloc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class InputIt>
|
template <typename InputIt>
|
||||||
hopscotch_sc_set(InputIt first, InputIt last,
|
hopscotch_sc_set(InputIt first, InputIt last,
|
||||||
size_type bucket_count = ht::DEFAULT_INIT_BUCKETS_SIZE,
|
size_type bucket_count = ht::DEFAULT_INIT_BUCKETS_SIZE,
|
||||||
const Hash& hash = Hash(),
|
const Hash& hash = Hash(),
|
||||||
@ -143,14 +143,14 @@ public:
|
|||||||
insert(first, last);
|
insert(first, last);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class InputIt>
|
template <typename InputIt>
|
||||||
hopscotch_sc_set(InputIt first, InputIt last,
|
hopscotch_sc_set(InputIt first, InputIt last,
|
||||||
size_type bucket_count,
|
size_type bucket_count,
|
||||||
const Allocator& alloc) : hopscotch_sc_set(first, last, bucket_count, Hash(), KeyEqual(), alloc)
|
const Allocator& alloc) : hopscotch_sc_set(first, last, bucket_count, Hash(), KeyEqual(), alloc)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class InputIt>
|
template <typename InputIt>
|
||||||
hopscotch_sc_set(InputIt first, InputIt last,
|
hopscotch_sc_set(InputIt first, InputIt last,
|
||||||
size_type bucket_count,
|
size_type bucket_count,
|
||||||
const Hash& hash,
|
const Hash& hash,
|
||||||
@ -228,7 +228,7 @@ public:
|
|||||||
iterator insert(const_iterator hint, const value_type& value) { return m_ht.insert(hint, value); }
|
iterator insert(const_iterator hint, const value_type& value) { return m_ht.insert(hint, value); }
|
||||||
iterator insert(const_iterator hint, value_type&& value) { return m_ht.insert(hint, std::move(value)); }
|
iterator insert(const_iterator hint, value_type&& value) { return m_ht.insert(hint, std::move(value)); }
|
||||||
|
|
||||||
template<class InputIt>
|
template <typename InputIt>
|
||||||
void insert(InputIt first, InputIt last) { m_ht.insert(first, last); }
|
void insert(InputIt first, InputIt last) { m_ht.insert(first, last); }
|
||||||
void insert(std::initializer_list<value_type> ilist) { m_ht.insert(ilist.begin(), ilist.end()); }
|
void insert(std::initializer_list<value_type> ilist) { m_ht.insert(ilist.begin(), ilist.end()); }
|
||||||
|
|
||||||
@ -241,7 +241,7 @@ public:
|
|||||||
*
|
*
|
||||||
* Mainly here for compatibility with the std::unordered_map interface.
|
* Mainly here for compatibility with the std::unordered_map interface.
|
||||||
*/
|
*/
|
||||||
template<class... Args>
|
template <typename... Args>
|
||||||
std::pair<iterator, bool> emplace(Args&&... args) { return m_ht.emplace(std::forward<Args>(args)...); }
|
std::pair<iterator, bool> emplace(Args&&... args) { return m_ht.emplace(std::forward<Args>(args)...); }
|
||||||
|
|
||||||
|
|
||||||
@ -253,7 +253,7 @@ public:
|
|||||||
*
|
*
|
||||||
* Mainly here for compatibility with the std::unordered_map interface.
|
* Mainly here for compatibility with the std::unordered_map interface.
|
||||||
*/
|
*/
|
||||||
template<class... Args>
|
template <typename... Args>
|
||||||
iterator emplace_hint(const_iterator hint, Args&&... args) {
|
iterator emplace_hint(const_iterator hint, Args&&... args) {
|
||||||
return m_ht.emplace_hint(hint, std::forward<Args>(args)...);
|
return m_ht.emplace_hint(hint, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
@ -279,7 +279,7 @@ public:
|
|||||||
* and Compare::is_transparent exist.
|
* and Compare::is_transparent exist.
|
||||||
* If so, K must be hashable and comparable to Key.
|
* If so, K must be hashable and comparable to Key.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
size_type erase(const K& key) { return m_ht.erase(key); }
|
size_type erase(const K& key) { return m_ht.erase(key); }
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ public:
|
|||||||
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
||||||
* as hash_function()(key). Usefull to speed-up the lookup to the value if you already have the hash.
|
* as hash_function()(key). Usefull to speed-up the lookup to the value if you already have the hash.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
size_type erase(const K& key, std::size_t precalculated_hash) { return m_ht.erase(key, precalculated_hash); }
|
size_type erase(const K& key, std::size_t precalculated_hash) { return m_ht.erase(key, precalculated_hash); }
|
||||||
|
|
||||||
@ -315,7 +315,7 @@ public:
|
|||||||
* and Compare::is_transparent exist.
|
* and Compare::is_transparent exist.
|
||||||
* If so, K must be hashable and comparable to Key.
|
* If so, K must be hashable and comparable to Key.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
size_type count(const K& key) const { return m_ht.count(key); }
|
size_type count(const K& key) const { return m_ht.count(key); }
|
||||||
|
|
||||||
@ -325,7 +325,7 @@ public:
|
|||||||
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
||||||
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
size_type count(const K& key, std::size_t precalculated_hash) const { return m_ht.count(key, precalculated_hash); }
|
size_type count(const K& key, std::size_t precalculated_hash) const { return m_ht.count(key, precalculated_hash); }
|
||||||
|
|
||||||
@ -352,7 +352,7 @@ public:
|
|||||||
* and Compare::is_transparent exist.
|
* and Compare::is_transparent exist.
|
||||||
* If so, K must be hashable and comparable to Key.
|
* If so, K must be hashable and comparable to Key.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
iterator find(const K& key) { return m_ht.find(key); }
|
iterator find(const K& key) { return m_ht.find(key); }
|
||||||
|
|
||||||
@ -362,14 +362,14 @@ public:
|
|||||||
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
||||||
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
iterator find(const K& key, std::size_t precalculated_hash) { return m_ht.find(key, precalculated_hash); }
|
iterator find(const K& key, std::size_t precalculated_hash) { return m_ht.find(key, precalculated_hash); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copydoc find(const K& key)
|
* @copydoc find(const K& key)
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
const_iterator find(const K& key) const { return m_ht.find(key); }
|
const_iterator find(const K& key) const { return m_ht.find(key); }
|
||||||
|
|
||||||
@ -379,7 +379,7 @@ public:
|
|||||||
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
||||||
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
const_iterator find(const K& key, std::size_t precalculated_hash) const { return m_ht.find(key, precalculated_hash); }
|
const_iterator find(const K& key, std::size_t precalculated_hash) const { return m_ht.find(key, precalculated_hash); }
|
||||||
|
|
||||||
@ -410,7 +410,7 @@ public:
|
|||||||
* and Compare::is_transparent exist.
|
* and Compare::is_transparent exist.
|
||||||
* If so, K must be hashable and comparable to Key.
|
* If so, K must be hashable and comparable to Key.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
std::pair<iterator, iterator> equal_range(const K& key) { return m_ht.equal_range(key); }
|
std::pair<iterator, iterator> equal_range(const K& key) { return m_ht.equal_range(key); }
|
||||||
|
|
||||||
@ -420,7 +420,7 @@ public:
|
|||||||
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
||||||
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
std::pair<iterator, iterator> equal_range(const K& key, std::size_t precalculated_hash) {
|
std::pair<iterator, iterator> equal_range(const K& key, std::size_t precalculated_hash) {
|
||||||
return m_ht.equal_range(key, precalculated_hash);
|
return m_ht.equal_range(key, precalculated_hash);
|
||||||
@ -429,14 +429,14 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @copydoc equal_range(const K& key)
|
* @copydoc equal_range(const K& key)
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
std::pair<const_iterator, const_iterator> equal_range(const K& key) const { return m_ht.equal_range(key); }
|
std::pair<const_iterator, const_iterator> equal_range(const K& key) const { return m_ht.equal_range(key); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copydoc equal_range(const K& key, std::size_t precalculated_hash)
|
* @copydoc equal_range(const K& key, std::size_t precalculated_hash)
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, class CP = Compare,
|
template <typename K, typename KE = KeyEqual, typename CP = Compare,
|
||||||
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
typename std::enable_if<has_is_transparent<KE>::value && has_is_transparent<CP>::value>::type* = nullptr>
|
||||||
std::pair<const_iterator, const_iterator> equal_range(const K& key, std::size_t precalculated_hash) const {
|
std::pair<const_iterator, const_iterator> equal_range(const K& key, std::size_t precalculated_hash) const {
|
||||||
return m_ht.equal_range(key, precalculated_hash);
|
return m_ht.equal_range(key, precalculated_hash);
|
||||||
|
@ -68,7 +68,7 @@ namespace tsl {
|
|||||||
* insert will invalidate the iterators). Or if there is a rehash.
|
* insert will invalidate the iterators). Or if there is a rehash.
|
||||||
* - erase: iterator on the erased element is the only one which become invalid.
|
* - erase: iterator on the erased element is the only one which become invalid.
|
||||||
*/
|
*/
|
||||||
template<class Key,
|
template <typename Key,
|
||||||
class Hash = std::hash<Key>,
|
class Hash = std::hash<Key>,
|
||||||
class KeyEqual = std::equal_to<Key>,
|
class KeyEqual = std::equal_to<Key>,
|
||||||
class Allocator = std::allocator<Key>,
|
class Allocator = std::allocator<Key>,
|
||||||
@ -145,7 +145,7 @@ public:
|
|||||||
explicit hopscotch_set(const Allocator& alloc) : hopscotch_set(ht::DEFAULT_INIT_BUCKETS_SIZE, alloc) {
|
explicit hopscotch_set(const Allocator& alloc) : hopscotch_set(ht::DEFAULT_INIT_BUCKETS_SIZE, alloc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class InputIt>
|
template <typename InputIt>
|
||||||
hopscotch_set(InputIt first, InputIt last,
|
hopscotch_set(InputIt first, InputIt last,
|
||||||
size_type bucket_count = ht::DEFAULT_INIT_BUCKETS_SIZE,
|
size_type bucket_count = ht::DEFAULT_INIT_BUCKETS_SIZE,
|
||||||
const Hash& hash = Hash(),
|
const Hash& hash = Hash(),
|
||||||
@ -155,14 +155,14 @@ public:
|
|||||||
insert(first, last);
|
insert(first, last);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class InputIt>
|
template <typename InputIt>
|
||||||
hopscotch_set(InputIt first, InputIt last,
|
hopscotch_set(InputIt first, InputIt last,
|
||||||
size_type bucket_count,
|
size_type bucket_count,
|
||||||
const Allocator& alloc) : hopscotch_set(first, last, bucket_count, Hash(), KeyEqual(), alloc)
|
const Allocator& alloc) : hopscotch_set(first, last, bucket_count, Hash(), KeyEqual(), alloc)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class InputIt>
|
template <typename InputIt>
|
||||||
hopscotch_set(InputIt first, InputIt last,
|
hopscotch_set(InputIt first, InputIt last,
|
||||||
size_type bucket_count,
|
size_type bucket_count,
|
||||||
const Hash& hash,
|
const Hash& hash,
|
||||||
@ -240,7 +240,7 @@ public:
|
|||||||
iterator insert(const_iterator hint, const value_type& value) { return m_ht.insert(hint, value); }
|
iterator insert(const_iterator hint, const value_type& value) { return m_ht.insert(hint, value); }
|
||||||
iterator insert(const_iterator hint, value_type&& value) { return m_ht.insert(hint, std::move(value)); }
|
iterator insert(const_iterator hint, value_type&& value) { return m_ht.insert(hint, std::move(value)); }
|
||||||
|
|
||||||
template<class InputIt>
|
template <typename InputIt>
|
||||||
void insert(InputIt first, InputIt last) { m_ht.insert(first, last); }
|
void insert(InputIt first, InputIt last) { m_ht.insert(first, last); }
|
||||||
void insert(std::initializer_list<value_type> ilist) { m_ht.insert(ilist.begin(), ilist.end()); }
|
void insert(std::initializer_list<value_type> ilist) { m_ht.insert(ilist.begin(), ilist.end()); }
|
||||||
|
|
||||||
@ -253,7 +253,7 @@ public:
|
|||||||
*
|
*
|
||||||
* Mainly here for compatibility with the std::unordered_map interface.
|
* Mainly here for compatibility with the std::unordered_map interface.
|
||||||
*/
|
*/
|
||||||
template<class... Args>
|
template <typename... Args>
|
||||||
std::pair<iterator, bool> emplace(Args&&... args) { return m_ht.emplace(std::forward<Args>(args)...); }
|
std::pair<iterator, bool> emplace(Args&&... args) { return m_ht.emplace(std::forward<Args>(args)...); }
|
||||||
|
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ public:
|
|||||||
*
|
*
|
||||||
* Mainly here for compatibility with the std::unordered_map interface.
|
* Mainly here for compatibility with the std::unordered_map interface.
|
||||||
*/
|
*/
|
||||||
template<class... Args>
|
template <typename... Args>
|
||||||
iterator emplace_hint(const_iterator hint, Args&&... args) {
|
iterator emplace_hint(const_iterator hint, Args&&... args) {
|
||||||
return m_ht.emplace_hint(hint, std::forward<Args>(args)...);
|
return m_ht.emplace_hint(hint, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
@ -290,7 +290,7 @@ public:
|
|||||||
* This overload only participates in the overload resolution if the typedef KeyEqual::is_transparent exists.
|
* This overload only participates in the overload resolution if the typedef KeyEqual::is_transparent exists.
|
||||||
* If so, K must be hashable and comparable to Key.
|
* If so, K must be hashable and comparable to Key.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
size_type erase(const K& key) { return m_ht.erase(key); }
|
size_type erase(const K& key) { return m_ht.erase(key); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -299,7 +299,7 @@ public:
|
|||||||
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
||||||
* as hash_function()(key). Usefull to speed-up the lookup to the value if you already have the hash.
|
* as hash_function()(key). Usefull to speed-up the lookup to the value if you already have the hash.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
size_type erase(const K& key, std::size_t precalculated_hash) {
|
size_type erase(const K& key, std::size_t precalculated_hash) {
|
||||||
return m_ht.erase(key, precalculated_hash);
|
return m_ht.erase(key, precalculated_hash);
|
||||||
}
|
}
|
||||||
@ -325,7 +325,7 @@ public:
|
|||||||
* This overload only participates in the overload resolution if the typedef KeyEqual::is_transparent exists.
|
* This overload only participates in the overload resolution if the typedef KeyEqual::is_transparent exists.
|
||||||
* If so, K must be hashable and comparable to Key.
|
* If so, K must be hashable and comparable to Key.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
size_type count(const K& key) const { return m_ht.count(key); }
|
size_type count(const K& key) const { return m_ht.count(key); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -334,7 +334,7 @@ public:
|
|||||||
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
||||||
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
size_type count(const K& key, std::size_t precalculated_hash) const { return m_ht.count(key, precalculated_hash); }
|
size_type count(const K& key, std::size_t precalculated_hash) const { return m_ht.count(key, precalculated_hash); }
|
||||||
|
|
||||||
|
|
||||||
@ -359,7 +359,7 @@ public:
|
|||||||
* This overload only participates in the overload resolution if the typedef KeyEqual::is_transparent exists.
|
* This overload only participates in the overload resolution if the typedef KeyEqual::is_transparent exists.
|
||||||
* If so, K must be hashable and comparable to Key.
|
* If so, K must be hashable and comparable to Key.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
iterator find(const K& key) { return m_ht.find(key); }
|
iterator find(const K& key) { return m_ht.find(key); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -368,13 +368,13 @@ public:
|
|||||||
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
||||||
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
iterator find(const K& key, std::size_t precalculated_hash) { return m_ht.find(key, precalculated_hash); }
|
iterator find(const K& key, std::size_t precalculated_hash) { return m_ht.find(key, precalculated_hash); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copydoc find(const K& key)
|
* @copydoc find(const K& key)
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
const_iterator find(const K& key) const { return m_ht.find(key); }
|
const_iterator find(const K& key) const { return m_ht.find(key); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -383,7 +383,7 @@ public:
|
|||||||
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
||||||
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
const_iterator find(const K& key, std::size_t precalculated_hash) const { return m_ht.find(key, precalculated_hash); }
|
const_iterator find(const K& key, std::size_t precalculated_hash) const { return m_ht.find(key, precalculated_hash); }
|
||||||
|
|
||||||
|
|
||||||
@ -412,7 +412,7 @@ public:
|
|||||||
* This overload only participates in the overload resolution if the typedef KeyEqual::is_transparent exists.
|
* This overload only participates in the overload resolution if the typedef KeyEqual::is_transparent exists.
|
||||||
* If so, K must be hashable and comparable to Key.
|
* If so, K must be hashable and comparable to Key.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
std::pair<iterator, iterator> equal_range(const K& key) { return m_ht.equal_range(key); }
|
std::pair<iterator, iterator> equal_range(const K& key) { return m_ht.equal_range(key); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -421,7 +421,7 @@ public:
|
|||||||
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
* Use the hash value 'precalculated_hash' instead of hashing the key. The hash value should be the same
|
||||||
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
* as hash_function()(key). Usefull to speed-up the lookup if you already have the hash.
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
std::pair<iterator, iterator> equal_range(const K& key, std::size_t precalculated_hash) {
|
std::pair<iterator, iterator> equal_range(const K& key, std::size_t precalculated_hash) {
|
||||||
return m_ht.equal_range(key, precalculated_hash);
|
return m_ht.equal_range(key, precalculated_hash);
|
||||||
}
|
}
|
||||||
@ -429,13 +429,13 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @copydoc equal_range(const K& key)
|
* @copydoc equal_range(const K& key)
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
std::pair<const_iterator, const_iterator> equal_range(const K& key) const { return m_ht.equal_range(key); }
|
std::pair<const_iterator, const_iterator> equal_range(const K& key) const { return m_ht.equal_range(key); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copydoc equal_range(const K& key, std::size_t precalculated_hash)
|
* @copydoc equal_range(const K& key, std::size_t precalculated_hash)
|
||||||
*/
|
*/
|
||||||
template<class K, class KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
template <typename K, typename KE = KeyEqual, typename std::enable_if<has_is_transparent<KE>::value>::type* = nullptr>
|
||||||
std::pair<const_iterator, const_iterator> equal_range(const K& key, std::size_t precalculated_hash) const {
|
std::pair<const_iterator, const_iterator> equal_range(const K& key, std::size_t precalculated_hash) const {
|
||||||
return m_ht.equal_range(key, precalculated_hash);
|
return m_ht.equal_range(key, precalculated_hash);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ Block AggregatingSortedBlockInputStream::readImpl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class TSortCursor>
|
template <typename TSortCursor>
|
||||||
void AggregatingSortedBlockInputStream::merge(ColumnPlainPtrs & merged_columns, std::priority_queue<TSortCursor> & queue)
|
void AggregatingSortedBlockInputStream::merge(ColumnPlainPtrs & merged_columns, std::priority_queue<TSortCursor> & queue)
|
||||||
{
|
{
|
||||||
size_t merged_rows = 0;
|
size_t merged_rows = 0;
|
||||||
@ -133,7 +133,7 @@ void AggregatingSortedBlockInputStream::merge(ColumnPlainPtrs & merged_columns,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class TSortCursor>
|
template <typename TSortCursor>
|
||||||
void AggregatingSortedBlockInputStream::addRow(TSortCursor & cursor)
|
void AggregatingSortedBlockInputStream::addRow(TSortCursor & cursor)
|
||||||
{
|
{
|
||||||
for (size_t i = 0, size = column_numbers_to_aggregate.size(); i < size; ++i)
|
for (size_t i = 0, size = column_numbers_to_aggregate.size(); i < size; ++i)
|
||||||
|
@ -70,12 +70,12 @@ private:
|
|||||||
/** We support two different cursors - with Collation and without.
|
/** We support two different cursors - with Collation and without.
|
||||||
* Templates are used instead of polymorphic SortCursor and calls to virtual functions.
|
* Templates are used instead of polymorphic SortCursor and calls to virtual functions.
|
||||||
*/
|
*/
|
||||||
template <class TSortCursor>
|
template <typename TSortCursor>
|
||||||
void merge(ColumnPlainPtrs & merged_columns, std::priority_queue<TSortCursor> & queue);
|
void merge(ColumnPlainPtrs & merged_columns, std::priority_queue<TSortCursor> & queue);
|
||||||
|
|
||||||
/** Extract all states of aggregate functions and merge them with the current group.
|
/** Extract all states of aggregate functions and merge them with the current group.
|
||||||
*/
|
*/
|
||||||
template <class TSortCursor>
|
template <typename TSortCursor>
|
||||||
void addRow(TSortCursor & cursor);
|
void addRow(TSortCursor & cursor);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ Block CollapsingSortedBlockInputStream::readImpl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class TSortCursor>
|
template <typename TSortCursor>
|
||||||
void CollapsingSortedBlockInputStream::merge(ColumnPlainPtrs & merged_columns, std::priority_queue<TSortCursor> & queue)
|
void CollapsingSortedBlockInputStream::merge(ColumnPlainPtrs & merged_columns, std::priority_queue<TSortCursor> & queue)
|
||||||
{
|
{
|
||||||
size_t merged_rows = 0;
|
size_t merged_rows = 0;
|
||||||
|
@ -90,7 +90,7 @@ private:
|
|||||||
/** We support two different cursors - with Collation and without.
|
/** We support two different cursors - with Collation and without.
|
||||||
* Templates are used instead of polymorphic SortCursors and calls to virtual functions.
|
* Templates are used instead of polymorphic SortCursors and calls to virtual functions.
|
||||||
*/
|
*/
|
||||||
template<class TSortCursor>
|
template <typename TSortCursor>
|
||||||
void merge(ColumnPlainPtrs & merged_columns, std::priority_queue<TSortCursor> & queue);
|
void merge(ColumnPlainPtrs & merged_columns, std::priority_queue<TSortCursor> & queue);
|
||||||
|
|
||||||
/// Output to result rows for the current primary key.
|
/// Output to result rows for the current primary key.
|
||||||
|
@ -218,7 +218,7 @@ void GraphiteRollupSortedBlockInputStream::merge(ColumnPlainPtrs & merged_column
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class TSortCursor>
|
template <typename TSortCursor>
|
||||||
void GraphiteRollupSortedBlockInputStream::startNextRow(ColumnPlainPtrs & merged_columns, TSortCursor & cursor, const Graphite::Pattern * next_pattern)
|
void GraphiteRollupSortedBlockInputStream::startNextRow(ColumnPlainPtrs & merged_columns, TSortCursor & cursor, const Graphite::Pattern * next_pattern)
|
||||||
{
|
{
|
||||||
/// Copy unmodified column values.
|
/// Copy unmodified column values.
|
||||||
|
@ -199,7 +199,7 @@ private:
|
|||||||
void merge(ColumnPlainPtrs & merged_columns, std::priority_queue<TSortCursor> & queue);
|
void merge(ColumnPlainPtrs & merged_columns, std::priority_queue<TSortCursor> & queue);
|
||||||
|
|
||||||
/// Insert the values into the resulting columns, which will not be changed in the future.
|
/// Insert the values into the resulting columns, which will not be changed in the future.
|
||||||
template <class TSortCursor>
|
template <typename TSortCursor>
|
||||||
void startNextRow(ColumnPlainPtrs & merged_columns, TSortCursor & cursor, const Graphite::Pattern * next_pattern);
|
void startNextRow(ColumnPlainPtrs & merged_columns, TSortCursor & cursor, const Graphite::Pattern * next_pattern);
|
||||||
|
|
||||||
/// Insert the calculated `time`, `value`, `version` values into the resulting columns by the last group of rows.
|
/// Insert the calculated `time`, `value`, `version` values into the resulting columns by the last group of rows.
|
||||||
|
@ -153,7 +153,7 @@ protected:
|
|||||||
/// These methods are used in Collapsing/Summing/Aggregating... SortedBlockInputStream-s.
|
/// These methods are used in Collapsing/Summing/Aggregating... SortedBlockInputStream-s.
|
||||||
|
|
||||||
/// Save the row pointed to by cursor in `row`.
|
/// Save the row pointed to by cursor in `row`.
|
||||||
template <class TSortCursor>
|
template <typename TSortCursor>
|
||||||
void setRow(Row & row, TSortCursor & cursor)
|
void setRow(Row & row, TSortCursor & cursor)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < num_columns; ++i)
|
for (size_t i = 0; i < num_columns; ++i)
|
||||||
@ -185,7 +185,7 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class TSortCursor>
|
template <typename TSortCursor>
|
||||||
void setRowRef(RowRef & row_ref, TSortCursor & cursor)
|
void setRowRef(RowRef & row_ref, TSortCursor & cursor)
|
||||||
{
|
{
|
||||||
row_ref.row_num = cursor.impl->pos;
|
row_ref.row_num = cursor.impl->pos;
|
||||||
@ -195,7 +195,7 @@ protected:
|
|||||||
row_ref.columns[i] = cursor->all_columns[i];
|
row_ref.columns[i] = cursor->all_columns[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class TSortCursor>
|
template <typename TSortCursor>
|
||||||
void setPrimaryKeyRef(RowRef & row_ref, TSortCursor & cursor)
|
void setPrimaryKeyRef(RowRef & row_ref, TSortCursor & cursor)
|
||||||
{
|
{
|
||||||
row_ref.row_num = cursor.impl->pos;
|
row_ref.row_num = cursor.impl->pos;
|
||||||
|
@ -58,7 +58,7 @@ Block ReplacingSortedBlockInputStream::readImpl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class TSortCursor>
|
template <typename TSortCursor>
|
||||||
void ReplacingSortedBlockInputStream::merge(ColumnPlainPtrs & merged_columns, std::priority_queue<TSortCursor> & queue)
|
void ReplacingSortedBlockInputStream::merge(ColumnPlainPtrs & merged_columns, std::priority_queue<TSortCursor> & queue)
|
||||||
{
|
{
|
||||||
size_t merged_rows = 0;
|
size_t merged_rows = 0;
|
||||||
|
@ -63,7 +63,7 @@ private:
|
|||||||
|
|
||||||
PODArray<RowSourcePart> current_row_sources; /// Sources of rows with the current primary key
|
PODArray<RowSourcePart> current_row_sources; /// Sources of rows with the current primary key
|
||||||
|
|
||||||
template<class TSortCursor>
|
template <typename TSortCursor>
|
||||||
void merge(ColumnPlainPtrs & merged_columns, std::priority_queue<TSortCursor> & queue);
|
void merge(ColumnPlainPtrs & merged_columns, std::priority_queue<TSortCursor> & queue);
|
||||||
|
|
||||||
/// Output into result the rows for current primary key.
|
/// Output into result the rows for current primary key.
|
||||||
|
@ -176,7 +176,7 @@ Block SummingSortedBlockInputStream::readImpl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class TSortCursor>
|
template <typename TSortCursor>
|
||||||
void SummingSortedBlockInputStream::merge(ColumnPlainPtrs & merged_columns, std::priority_queue<TSortCursor> & queue)
|
void SummingSortedBlockInputStream::merge(ColumnPlainPtrs & merged_columns, std::priority_queue<TSortCursor> & queue)
|
||||||
{
|
{
|
||||||
size_t merged_rows = 0;
|
size_t merged_rows = 0;
|
||||||
@ -269,7 +269,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template <class TSortCursor>
|
template <typename TSortCursor>
|
||||||
bool SummingSortedBlockInputStream::mergeMaps(Row & row, TSortCursor & cursor)
|
bool SummingSortedBlockInputStream::mergeMaps(Row & row, TSortCursor & cursor)
|
||||||
{
|
{
|
||||||
bool non_empty_map_present = false;
|
bool non_empty_map_present = false;
|
||||||
@ -283,7 +283,7 @@ bool SummingSortedBlockInputStream::mergeMaps(Row & row, TSortCursor & cursor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class TSortCursor>
|
template <typename TSortCursor>
|
||||||
bool SummingSortedBlockInputStream::mergeMap(const MapDescription & desc, Row & row, TSortCursor & cursor)
|
bool SummingSortedBlockInputStream::mergeMap(const MapDescription & desc, Row & row, TSortCursor & cursor)
|
||||||
{
|
{
|
||||||
/// Strongly non-optimal.
|
/// Strongly non-optimal.
|
||||||
@ -367,7 +367,7 @@ bool SummingSortedBlockInputStream::mergeMap(const MapDescription & desc, Row &
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class TSortCursor>
|
template <typename TSortCursor>
|
||||||
bool SummingSortedBlockInputStream::addRow(Row & row, TSortCursor & cursor)
|
bool SummingSortedBlockInputStream::addRow(Row & row, TSortCursor & cursor)
|
||||||
{
|
{
|
||||||
bool res = mergeMaps(row, cursor); /// Is there at least one non-zero number or non-empty array
|
bool res = mergeMaps(row, cursor); /// Is there at least one non-zero number or non-empty array
|
||||||
|
@ -90,7 +90,7 @@ private:
|
|||||||
/** We support two different cursors - with Collation and without.
|
/** We support two different cursors - with Collation and without.
|
||||||
* Templates are used instead of polymorphic SortCursor and calls to virtual functions.
|
* Templates are used instead of polymorphic SortCursor and calls to virtual functions.
|
||||||
*/
|
*/
|
||||||
template <class TSortCursor>
|
template <typename TSortCursor>
|
||||||
void merge(ColumnPlainPtrs & merged_columns, std::priority_queue<TSortCursor> & queue);
|
void merge(ColumnPlainPtrs & merged_columns, std::priority_queue<TSortCursor> & queue);
|
||||||
|
|
||||||
/// Insert the summed row for the current group into the result.
|
/// Insert the summed row for the current group into the result.
|
||||||
@ -99,16 +99,16 @@ private:
|
|||||||
/** For nested Map, a merge by key is performed with the ejection of rows of nested arrays, in which
|
/** For nested Map, a merge by key is performed with the ejection of rows of nested arrays, in which
|
||||||
* all items are zero.
|
* all items are zero.
|
||||||
*/
|
*/
|
||||||
template <class TSortCursor>
|
template <typename TSortCursor>
|
||||||
bool mergeMaps(Row & row, TSortCursor & cursor);
|
bool mergeMaps(Row & row, TSortCursor & cursor);
|
||||||
|
|
||||||
template <class TSortCursor>
|
template <typename TSortCursor>
|
||||||
bool mergeMap(const MapDescription & map, Row & row, TSortCursor & cursor);
|
bool mergeMap(const MapDescription & map, Row & row, TSortCursor & cursor);
|
||||||
|
|
||||||
/** Add the row under the cursor to the `row`.
|
/** Add the row under the cursor to the `row`.
|
||||||
* Returns false if the result is zero.
|
* Returns false if the result is zero.
|
||||||
*/
|
*/
|
||||||
template <class TSortCursor>
|
template <typename TSortCursor>
|
||||||
bool addRow(Row & row, TSortCursor & cursor);
|
bool addRow(Row & row, TSortCursor & cursor);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ namespace DB
|
|||||||
* BlockInputStream implementation for external dictionaries
|
* BlockInputStream implementation for external dictionaries
|
||||||
* read() returns single block consisting of the in-memory contents of the dictionaries
|
* read() returns single block consisting of the in-memory contents of the dictionaries
|
||||||
*/
|
*/
|
||||||
template <class DictionaryType, class Key>
|
template <typename DictionaryType, typename Key>
|
||||||
class DictionaryBlockInputStream : public DictionaryBlockInputStreamBase
|
class DictionaryBlockInputStream : public DictionaryBlockInputStreamBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -51,13 +51,13 @@ protected:
|
|||||||
private:
|
private:
|
||||||
// pointer types to getXXX functions
|
// pointer types to getXXX functions
|
||||||
// for single key dictionaries
|
// for single key dictionaries
|
||||||
template <class Type>
|
template <typename Type>
|
||||||
using DictionaryGetter = void (DictionaryType::*)(
|
using DictionaryGetter = void (DictionaryType::*)(
|
||||||
const std::string &, const PaddedPODArray<Key> &, PaddedPODArray<Type> &) const;
|
const std::string &, const PaddedPODArray<Key> &, PaddedPODArray<Type> &) const;
|
||||||
using DictionaryStringGetter = void (DictionaryType::*)(
|
using DictionaryStringGetter = void (DictionaryType::*)(
|
||||||
const std::string &, const PaddedPODArray<Key> &, ColumnString *) const;
|
const std::string &, const PaddedPODArray<Key> &, ColumnString *) const;
|
||||||
// for complex complex key dictionaries
|
// for complex complex key dictionaries
|
||||||
template <class Type>
|
template <typename Type>
|
||||||
using GetterByKey = void (DictionaryType::*)(
|
using GetterByKey = void (DictionaryType::*)(
|
||||||
const std::string &, const Columns &, const DataTypes &, PaddedPODArray<Type> & out) const;
|
const std::string &, const Columns &, const DataTypes &, PaddedPODArray<Type> & out) const;
|
||||||
using StringGetterByKey = void (DictionaryType::*)(
|
using StringGetterByKey = void (DictionaryType::*)(
|
||||||
@ -65,34 +65,34 @@ private:
|
|||||||
|
|
||||||
// call getXXX
|
// call getXXX
|
||||||
// for single key dictionaries
|
// for single key dictionaries
|
||||||
template <class Type, class Container>
|
template <typename Type, typename Container>
|
||||||
void callGetter(DictionaryGetter<Type> getter, const PaddedPODArray<Key> & ids,
|
void callGetter(DictionaryGetter<Type> getter, const PaddedPODArray<Key> & ids,
|
||||||
const Columns & keys, const DataTypes & data_types,
|
const Columns & keys, const DataTypes & data_types,
|
||||||
Container & container, const DictionaryAttribute & attribute, const DictionaryType & dictionary) const;
|
Container & container, const DictionaryAttribute & attribute, const DictionaryType & dictionary) const;
|
||||||
template <class Container>
|
template <typename Container>
|
||||||
void callGetter(DictionaryStringGetter getter, const PaddedPODArray<Key> & ids,
|
void callGetter(DictionaryStringGetter getter, const PaddedPODArray<Key> & ids,
|
||||||
const Columns & keys, const DataTypes & data_types,
|
const Columns & keys, const DataTypes & data_types,
|
||||||
Container & container, const DictionaryAttribute & attribute, const DictionaryType & dictionary) const;
|
Container & container, const DictionaryAttribute & attribute, const DictionaryType & dictionary) const;
|
||||||
// for complex complex key dictionaries
|
// for complex complex key dictionaries
|
||||||
template <class Type, class Container>
|
template <typename Type, typename Container>
|
||||||
void callGetter(GetterByKey<Type> getter, const PaddedPODArray<Key> & ids,
|
void callGetter(GetterByKey<Type> getter, const PaddedPODArray<Key> & ids,
|
||||||
const Columns & keys, const DataTypes & data_types,
|
const Columns & keys, const DataTypes & data_types,
|
||||||
Container & container, const DictionaryAttribute & attribute, const DictionaryType & dictionary) const;
|
Container & container, const DictionaryAttribute & attribute, const DictionaryType & dictionary) const;
|
||||||
template <class Container>
|
template <typename Container>
|
||||||
void callGetter(StringGetterByKey getter, const PaddedPODArray<Key> & ids,
|
void callGetter(StringGetterByKey getter, const PaddedPODArray<Key> & ids,
|
||||||
const Columns & keys, const DataTypes & data_types,
|
const Columns & keys, const DataTypes & data_types,
|
||||||
Container & container, const DictionaryAttribute & attribute, const DictionaryType & dictionary) const;
|
Container & container, const DictionaryAttribute & attribute, const DictionaryType & dictionary) const;
|
||||||
|
|
||||||
template <template <class> class Getter, class StringGetter>
|
template <template <typename> class Getter, typename StringGetter>
|
||||||
Block fillBlock(const PaddedPODArray<Key> & ids, const Columns & keys,
|
Block fillBlock(const PaddedPODArray<Key> & ids, const Columns & keys,
|
||||||
const DataTypes & types, ColumnsWithTypeAndName && view) const;
|
const DataTypes & types, ColumnsWithTypeAndName && view) const;
|
||||||
|
|
||||||
|
|
||||||
template <class AttributeType, class Getter>
|
template <typename AttributeType, typename Getter>
|
||||||
ColumnPtr getColumnFromAttribute(Getter getter, const PaddedPODArray<Key> & ids,
|
ColumnPtr getColumnFromAttribute(Getter getter, const PaddedPODArray<Key> & ids,
|
||||||
const Columns & keys, const DataTypes & data_types,
|
const Columns & keys, const DataTypes & data_types,
|
||||||
const DictionaryAttribute & attribute, const DictionaryType & dictionary) const;
|
const DictionaryAttribute & attribute, const DictionaryType & dictionary) const;
|
||||||
template <class Getter>
|
template <typename Getter>
|
||||||
ColumnPtr getColumnFromStringAttribute(Getter getter, const PaddedPODArray<Key> & ids,
|
ColumnPtr getColumnFromStringAttribute(Getter getter, const PaddedPODArray<Key> & ids,
|
||||||
const Columns & keys, const DataTypes & data_types,
|
const Columns & keys, const DataTypes & data_types,
|
||||||
const DictionaryAttribute& attribute, const DictionaryType& dictionary) const;
|
const DictionaryAttribute& attribute, const DictionaryType& dictionary) const;
|
||||||
@ -115,7 +115,7 @@ private:
|
|||||||
GetColumnsFunction get_view_columns_function;
|
GetColumnsFunction get_view_columns_function;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class DictionaryType, class Key>
|
template <typename DictionaryType, typename Key>
|
||||||
DictionaryBlockInputStream<DictionaryType, Key>::DictionaryBlockInputStream(
|
DictionaryBlockInputStream<DictionaryType, Key>::DictionaryBlockInputStream(
|
||||||
std::shared_ptr<const IDictionaryBase> dictionary, size_t max_block_size,
|
std::shared_ptr<const IDictionaryBase> dictionary, size_t max_block_size,
|
||||||
PaddedPODArray<Key> && ids, const Names& column_names)
|
PaddedPODArray<Key> && ids, const Names& column_names)
|
||||||
@ -127,7 +127,7 @@ DictionaryBlockInputStream<DictionaryType, Key>::DictionaryBlockInputStream(
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class DictionaryType, class Key>
|
template <typename DictionaryType, typename Key>
|
||||||
DictionaryBlockInputStream<DictionaryType, Key>::DictionaryBlockInputStream(
|
DictionaryBlockInputStream<DictionaryType, Key>::DictionaryBlockInputStream(
|
||||||
std::shared_ptr<const IDictionaryBase> dictionary, size_t max_block_size,
|
std::shared_ptr<const IDictionaryBase> dictionary, size_t max_block_size,
|
||||||
const std::vector<StringRef> & keys, const Names& column_names)
|
const std::vector<StringRef> & keys, const Names& column_names)
|
||||||
@ -140,7 +140,7 @@ DictionaryBlockInputStream<DictionaryType, Key>::DictionaryBlockInputStream(
|
|||||||
fillKeyColumns(keys, 0, keys.size(), dictionaty_structure, key_columns);
|
fillKeyColumns(keys, 0, keys.size(), dictionaty_structure, key_columns);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class DictionaryType, class Key>
|
template <typename DictionaryType, typename Key>
|
||||||
DictionaryBlockInputStream<DictionaryType, Key>::DictionaryBlockInputStream(
|
DictionaryBlockInputStream<DictionaryType, Key>::DictionaryBlockInputStream(
|
||||||
std::shared_ptr<const IDictionaryBase> dictionary, size_t max_block_size,
|
std::shared_ptr<const IDictionaryBase> dictionary, size_t max_block_size,
|
||||||
const Columns & data_columns, const Names & column_names,
|
const Columns & data_columns, const Names & column_names,
|
||||||
@ -155,7 +155,7 @@ DictionaryBlockInputStream<DictionaryType, Key>::DictionaryBlockInputStream(
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class DictionaryType, class Key>
|
template <typename DictionaryType, typename Key>
|
||||||
Block DictionaryBlockInputStream<DictionaryType, Key>::getBlock(size_t start, size_t length) const
|
Block DictionaryBlockInputStream<DictionaryType, Key>::getBlock(size_t start, size_t length) const
|
||||||
{
|
{
|
||||||
if (!key_columns.empty())
|
if (!key_columns.empty())
|
||||||
@ -197,8 +197,8 @@ Block DictionaryBlockInputStream<DictionaryType, Key>::getBlock(size_t start, si
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class DictionaryType, class Key>
|
template <typename DictionaryType, typename Key>
|
||||||
template <class Type, class Container>
|
template <typename Type, typename Container>
|
||||||
void DictionaryBlockInputStream<DictionaryType, Key>::callGetter(
|
void DictionaryBlockInputStream<DictionaryType, Key>::callGetter(
|
||||||
DictionaryGetter<Type> getter, const PaddedPODArray<Key> & ids,
|
DictionaryGetter<Type> getter, const PaddedPODArray<Key> & ids,
|
||||||
const Columns & keys, const DataTypes & data_types,
|
const Columns & keys, const DataTypes & data_types,
|
||||||
@ -207,8 +207,8 @@ void DictionaryBlockInputStream<DictionaryType, Key>::callGetter(
|
|||||||
(dictionary.*getter)(attribute.name, ids, container);
|
(dictionary.*getter)(attribute.name, ids, container);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class DictionaryType, class Key>
|
template <typename DictionaryType, typename Key>
|
||||||
template <class Container>
|
template <typename Container>
|
||||||
void DictionaryBlockInputStream<DictionaryType, Key>::callGetter(
|
void DictionaryBlockInputStream<DictionaryType, Key>::callGetter(
|
||||||
DictionaryStringGetter getter, const PaddedPODArray<Key> & ids,
|
DictionaryStringGetter getter, const PaddedPODArray<Key> & ids,
|
||||||
const Columns & keys, const DataTypes & data_types,
|
const Columns & keys, const DataTypes & data_types,
|
||||||
@ -217,8 +217,8 @@ void DictionaryBlockInputStream<DictionaryType, Key>::callGetter(
|
|||||||
(dictionary.*getter)(attribute.name, ids, container);
|
(dictionary.*getter)(attribute.name, ids, container);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class DictionaryType, class Key>
|
template <typename DictionaryType, typename Key>
|
||||||
template <class Type, class Container>
|
template <typename Type, typename Container>
|
||||||
void DictionaryBlockInputStream<DictionaryType, Key>::callGetter(
|
void DictionaryBlockInputStream<DictionaryType, Key>::callGetter(
|
||||||
GetterByKey<Type> getter, const PaddedPODArray<Key> & ids,
|
GetterByKey<Type> getter, const PaddedPODArray<Key> & ids,
|
||||||
const Columns & keys, const DataTypes & data_types,
|
const Columns & keys, const DataTypes & data_types,
|
||||||
@ -227,8 +227,8 @@ void DictionaryBlockInputStream<DictionaryType, Key>::callGetter(
|
|||||||
(dictionary.*getter)(attribute.name, keys, data_types, container);
|
(dictionary.*getter)(attribute.name, keys, data_types, container);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class DictionaryType, class Key>
|
template <typename DictionaryType, typename Key>
|
||||||
template <class Container>
|
template <typename Container>
|
||||||
void DictionaryBlockInputStream<DictionaryType, Key>::callGetter(
|
void DictionaryBlockInputStream<DictionaryType, Key>::callGetter(
|
||||||
StringGetterByKey getter, const PaddedPODArray<Key> & ids,
|
StringGetterByKey getter, const PaddedPODArray<Key> & ids,
|
||||||
const Columns & keys, const DataTypes & data_types,
|
const Columns & keys, const DataTypes & data_types,
|
||||||
@ -237,8 +237,8 @@ void DictionaryBlockInputStream<DictionaryType, Key>::callGetter(
|
|||||||
(dictionary.*getter)(attribute.name, keys, data_types, container);
|
(dictionary.*getter)(attribute.name, keys, data_types, container);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class DictionaryType, class Key>
|
template <typename DictionaryType, typename Key>
|
||||||
template <template <class> class Getter, class StringGetter>
|
template <template <typename> class Getter, typename StringGetter>
|
||||||
Block DictionaryBlockInputStream<DictionaryType, Key>::fillBlock(
|
Block DictionaryBlockInputStream<DictionaryType, Key>::fillBlock(
|
||||||
const PaddedPODArray<Key>& ids, const Columns& keys, const DataTypes & types, ColumnsWithTypeAndName && view) const
|
const PaddedPODArray<Key>& ids, const Columns& keys, const DataTypes & types, ColumnsWithTypeAndName && view) const
|
||||||
{
|
{
|
||||||
@ -317,8 +317,8 @@ Block DictionaryBlockInputStream<DictionaryType, Key>::fillBlock(
|
|||||||
return Block(block_columns);
|
return Block(block_columns);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class DictionaryType, class Key>
|
template <typename DictionaryType, typename Key>
|
||||||
template <class AttributeType, class Getter>
|
template <typename AttributeType, typename Getter>
|
||||||
ColumnPtr DictionaryBlockInputStream<DictionaryType, Key>::getColumnFromAttribute(
|
ColumnPtr DictionaryBlockInputStream<DictionaryType, Key>::getColumnFromAttribute(
|
||||||
Getter getter, const PaddedPODArray<Key> & ids,
|
Getter getter, const PaddedPODArray<Key> & ids,
|
||||||
const Columns & keys, const DataTypes & data_types,
|
const Columns & keys, const DataTypes & data_types,
|
||||||
@ -332,8 +332,8 @@ ColumnPtr DictionaryBlockInputStream<DictionaryType, Key>::getColumnFromAttribut
|
|||||||
return ColumnPtr(std::move(column_vector));
|
return ColumnPtr(std::move(column_vector));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class DictionaryType, class Key>
|
template <typename DictionaryType, typename Key>
|
||||||
template <class Getter>
|
template <typename Getter>
|
||||||
ColumnPtr DictionaryBlockInputStream<DictionaryType, Key>::getColumnFromStringAttribute(
|
ColumnPtr DictionaryBlockInputStream<DictionaryType, Key>::getColumnFromStringAttribute(
|
||||||
Getter getter, const PaddedPODArray<Key> & ids,
|
Getter getter, const PaddedPODArray<Key> & ids,
|
||||||
const Columns & keys, const DataTypes & data_types,
|
const Columns & keys, const DataTypes & data_types,
|
||||||
@ -345,7 +345,7 @@ ColumnPtr DictionaryBlockInputStream<DictionaryType, Key>::getColumnFromStringAt
|
|||||||
return column_string;
|
return column_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class DictionaryType, class Key>
|
template <typename DictionaryType, typename Key>
|
||||||
ColumnPtr DictionaryBlockInputStream<DictionaryType, Key>::getColumnFromIds(const PaddedPODArray<Key>& ids) const
|
ColumnPtr DictionaryBlockInputStream<DictionaryType, Key>::getColumnFromIds(const PaddedPODArray<Key>& ids) const
|
||||||
{
|
{
|
||||||
auto column_vector = std::make_shared<ColumnVector<UInt64>>();
|
auto column_vector = std::make_shared<ColumnVector<UInt64>>();
|
||||||
@ -357,7 +357,7 @@ ColumnPtr DictionaryBlockInputStream<DictionaryType, Key>::getColumnFromIds(cons
|
|||||||
return column_vector;
|
return column_vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class DictionaryType, class Key>
|
template <typename DictionaryType, typename Key>
|
||||||
void DictionaryBlockInputStream<DictionaryType, Key>::fillKeyColumns(
|
void DictionaryBlockInputStream<DictionaryType, Key>::fillKeyColumns(
|
||||||
const std::vector<StringRef> & keys, size_t start, size_t size,
|
const std::vector<StringRef> & keys, size_t start, size_t size,
|
||||||
const DictionaryStructure& dictionary_structure, ColumnsWithTypeAndName & columns) const
|
const DictionaryStructure& dictionary_structure, ColumnsWithTypeAndName & columns) const
|
||||||
|
@ -17,7 +17,7 @@ namespace DB
|
|||||||
* BlockInputStream implementation for external dictionaries
|
* BlockInputStream implementation for external dictionaries
|
||||||
* read() returns single block consisting of the in-memory contents of the dictionaries
|
* read() returns single block consisting of the in-memory contents of the dictionaries
|
||||||
*/
|
*/
|
||||||
template <class DictionaryType, class Key>
|
template <typename DictionaryType, typename Key>
|
||||||
class RangeDictionaryBlockInputStream : public DictionaryBlockInputStreamBase
|
class RangeDictionaryBlockInputStream : public DictionaryBlockInputStreamBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -35,20 +35,20 @@ protected:
|
|||||||
Block getBlock(size_t start, size_t length) const override;
|
Block getBlock(size_t start, size_t length) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <class Type>
|
template <typename Type>
|
||||||
using DictionaryGetter = void (DictionaryType::*)(const std::string &, const PaddedPODArray<Key> &,
|
using DictionaryGetter = void (DictionaryType::*)(const std::string &, const PaddedPODArray<Key> &,
|
||||||
const PaddedPODArray<UInt16> &, PaddedPODArray<Type> &) const;
|
const PaddedPODArray<UInt16> &, PaddedPODArray<Type> &) const;
|
||||||
|
|
||||||
template <class AttributeType>
|
template <typename AttributeType>
|
||||||
ColumnPtr getColumnFromAttribute(DictionaryGetter<AttributeType> getter,
|
ColumnPtr getColumnFromAttribute(DictionaryGetter<AttributeType> getter,
|
||||||
const PaddedPODArray<Key>& ids, const PaddedPODArray<UInt16> & dates,
|
const PaddedPODArray<Key>& ids, const PaddedPODArray<UInt16> & dates,
|
||||||
const DictionaryAttribute& attribute, const DictionaryType& dictionary) const;
|
const DictionaryAttribute& attribute, const DictionaryType& dictionary) const;
|
||||||
ColumnPtr getColumnFromAttributeString(const PaddedPODArray<Key>& ids, const PaddedPODArray<UInt16> & dates,
|
ColumnPtr getColumnFromAttributeString(const PaddedPODArray<Key>& ids, const PaddedPODArray<UInt16> & dates,
|
||||||
const DictionaryAttribute& attribute, const DictionaryType& dictionary) const;
|
const DictionaryAttribute& attribute, const DictionaryType& dictionary) const;
|
||||||
template <class T>
|
template <typename T>
|
||||||
ColumnPtr getColumnFromPODArray(const PaddedPODArray<T>& array) const;
|
ColumnPtr getColumnFromPODArray(const PaddedPODArray<T>& array) const;
|
||||||
|
|
||||||
template <class T>
|
template <typename T>
|
||||||
void addSpecialColumn(
|
void addSpecialColumn(
|
||||||
const std::experimental::optional<DictionarySpecialAttribute>& attribute, DataTypePtr type,
|
const std::experimental::optional<DictionarySpecialAttribute>& attribute, DataTypePtr type,
|
||||||
const std::string & default_name, const std::unordered_set<std::string> & column_names,
|
const std::string & default_name, const std::unordered_set<std::string> & column_names,
|
||||||
@ -65,7 +65,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template <class DictionaryType, class Key>
|
template <typename DictionaryType, typename Key>
|
||||||
RangeDictionaryBlockInputStream<DictionaryType, Key>::RangeDictionaryBlockInputStream(
|
RangeDictionaryBlockInputStream<DictionaryType, Key>::RangeDictionaryBlockInputStream(
|
||||||
DictionatyPtr dictionary, size_t max_column_size, const Names & column_names, PaddedPODArray<Key> && ids,
|
DictionatyPtr dictionary, size_t max_column_size, const Names & column_names, PaddedPODArray<Key> && ids,
|
||||||
PaddedPODArray<UInt16> && start_dates, PaddedPODArray<UInt16> && end_dates)
|
PaddedPODArray<UInt16> && start_dates, PaddedPODArray<UInt16> && end_dates)
|
||||||
@ -75,7 +75,7 @@ RangeDictionaryBlockInputStream<DictionaryType, Key>::RangeDictionaryBlockInputS
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class DictionaryType, class Key>
|
template <typename DictionaryType, typename Key>
|
||||||
Block RangeDictionaryBlockInputStream<DictionaryType, Key>::getBlock(size_t start, size_t length) const
|
Block RangeDictionaryBlockInputStream<DictionaryType, Key>::getBlock(size_t start, size_t length) const
|
||||||
{
|
{
|
||||||
PaddedPODArray<Key> block_ids;
|
PaddedPODArray<Key> block_ids;
|
||||||
@ -95,8 +95,8 @@ Block RangeDictionaryBlockInputStream<DictionaryType, Key>::getBlock(size_t star
|
|||||||
return fillBlock(block_ids, block_start_dates, block_end_dates);
|
return fillBlock(block_ids, block_start_dates, block_end_dates);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class DictionaryType, class Key>
|
template <typename DictionaryType, typename Key>
|
||||||
template <class AttributeType>
|
template <typename AttributeType>
|
||||||
ColumnPtr RangeDictionaryBlockInputStream<DictionaryType, Key>::getColumnFromAttribute(
|
ColumnPtr RangeDictionaryBlockInputStream<DictionaryType, Key>::getColumnFromAttribute(
|
||||||
DictionaryGetter<AttributeType> getter, const PaddedPODArray<Key>& ids,
|
DictionaryGetter<AttributeType> getter, const PaddedPODArray<Key>& ids,
|
||||||
const PaddedPODArray<UInt16> & dates, const DictionaryAttribute& attribute, const DictionaryType& dictionary) const
|
const PaddedPODArray<UInt16> & dates, const DictionaryAttribute& attribute, const DictionaryType& dictionary) const
|
||||||
@ -106,7 +106,7 @@ ColumnPtr RangeDictionaryBlockInputStream<DictionaryType, Key>::getColumnFromAtt
|
|||||||
return ColumnPtr(std::move(column_vector));
|
return ColumnPtr(std::move(column_vector));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class DictionaryType, class Key>
|
template <typename DictionaryType, typename Key>
|
||||||
ColumnPtr RangeDictionaryBlockInputStream<DictionaryType, Key>::getColumnFromAttributeString(
|
ColumnPtr RangeDictionaryBlockInputStream<DictionaryType, Key>::getColumnFromAttributeString(
|
||||||
const PaddedPODArray<Key>& ids, const PaddedPODArray<UInt16> & dates,
|
const PaddedPODArray<Key>& ids, const PaddedPODArray<UInt16> & dates,
|
||||||
const DictionaryAttribute& attribute, const DictionaryType& dictionary) const
|
const DictionaryAttribute& attribute, const DictionaryType& dictionary) const
|
||||||
@ -116,8 +116,8 @@ ColumnPtr RangeDictionaryBlockInputStream<DictionaryType, Key>::getColumnFromAtt
|
|||||||
return ColumnPtr(std::move(column_string));
|
return ColumnPtr(std::move(column_string));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class DictionaryType, class Key>
|
template <typename DictionaryType, typename Key>
|
||||||
template <class T>
|
template <typename T>
|
||||||
ColumnPtr RangeDictionaryBlockInputStream<DictionaryType, Key>::getColumnFromPODArray(const PaddedPODArray<T>& array) const
|
ColumnPtr RangeDictionaryBlockInputStream<DictionaryType, Key>::getColumnFromPODArray(const PaddedPODArray<T>& array) const
|
||||||
{
|
{
|
||||||
auto column_vector = std::make_unique<ColumnVector<T>>();
|
auto column_vector = std::make_unique<ColumnVector<T>>();
|
||||||
@ -130,8 +130,8 @@ ColumnPtr RangeDictionaryBlockInputStream<DictionaryType, Key>::getColumnFromPOD
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class DictionaryType, class Key>
|
template <typename DictionaryType, typename Key>
|
||||||
template <class T>
|
template <typename T>
|
||||||
void RangeDictionaryBlockInputStream<DictionaryType, Key>::addSpecialColumn(
|
void RangeDictionaryBlockInputStream<DictionaryType, Key>::addSpecialColumn(
|
||||||
const std::experimental::optional<DictionarySpecialAttribute> & attribute, DataTypePtr type,
|
const std::experimental::optional<DictionarySpecialAttribute> & attribute, DataTypePtr type,
|
||||||
const std::string& default_name, const std::unordered_set<std::string> & column_names,
|
const std::string& default_name, const std::unordered_set<std::string> & column_names,
|
||||||
@ -146,7 +146,7 @@ void RangeDictionaryBlockInputStream<DictionaryType, Key>::addSpecialColumn(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class DictionaryType, class Key>
|
template <typename DictionaryType, typename Key>
|
||||||
Block RangeDictionaryBlockInputStream<DictionaryType, Key>::fillBlock(
|
Block RangeDictionaryBlockInputStream<DictionaryType, Key>::fillBlock(
|
||||||
const PaddedPODArray<Key>& ids,
|
const PaddedPODArray<Key>& ids,
|
||||||
const PaddedPODArray<UInt16> & start_dates, const PaddedPODArray<UInt16> & end_dates) const
|
const PaddedPODArray<UInt16> & start_dates, const PaddedPODArray<UInt16> & end_dates) const
|
||||||
|
@ -331,7 +331,7 @@ struct ArraySumImpl
|
|||||||
throw Exception("arraySum cannot add values of type " + expression_return->getName(), ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
throw Exception("arraySum cannot add values of type " + expression_return->getName(), ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Element, class Result>
|
template <typename Element, typename Result>
|
||||||
static bool executeType(const ColumnPtr & mapped, const ColumnArray::Offsets_t & offsets, ColumnPtr & res_ptr)
|
static bool executeType(const ColumnPtr & mapped, const ColumnArray::Offsets_t & offsets, ColumnPtr & res_ptr)
|
||||||
{
|
{
|
||||||
const ColumnVector<Element> * column = checkAndGetColumn<ColumnVector<Element>>(&*mapped);
|
const ColumnVector<Element> * column = checkAndGetColumn<ColumnVector<Element>>(&*mapped);
|
||||||
|
@ -7,7 +7,7 @@ namespace DB
|
|||||||
|
|
||||||
/// computation of the hash depends on the partitioning of blocks
|
/// computation of the hash depends on the partitioning of blocks
|
||||||
/// so you need to compute a hash of n complete pieces and one incomplete
|
/// so you need to compute a hash of n complete pieces and one incomplete
|
||||||
template <class Buffer>
|
template <typename Buffer>
|
||||||
void IHashingBuffer<Buffer>::calculateHash(DB::BufferBase::Position data, size_t len)
|
void IHashingBuffer<Buffer>::calculateHash(DB::BufferBase::Position data, size_t len)
|
||||||
{
|
{
|
||||||
if (len)
|
if (len)
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
|
|
||||||
template <class Buffer>
|
template <typename Buffer>
|
||||||
class IHashingBuffer : public BufferWithOwnMemory<Buffer>
|
class IHashingBuffer : public BufferWithOwnMemory<Buffer>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -19,7 +19,7 @@ namespace ErrorCodes
|
|||||||
extern const int INCORRECT_DATA;
|
extern const int INCORRECT_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class IteratorSrc, class IteratorDst>
|
template <typename IteratorSrc, typename IteratorDst>
|
||||||
void parseHex(IteratorSrc src, IteratorDst dst, const size_t num_bytes)
|
void parseHex(IteratorSrc src, IteratorDst dst, const size_t num_bytes)
|
||||||
{
|
{
|
||||||
size_t src_pos = 0;
|
size_t src_pos = 0;
|
||||||
|
@ -351,7 +351,7 @@ void tryReadIntTextUnsafe(T & x, ReadBuffer & buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <bool throw_exception, class ExcepFun, class NoExcepFun, class... Args>
|
template <bool throw_exception, typename ExcepFun, typename NoExcepFun, typename... Args>
|
||||||
bool exceptionPolicySelector(ExcepFun && excep_f, NoExcepFun && no_excep_f, Args &&... args)
|
bool exceptionPolicySelector(ExcepFun && excep_f, NoExcepFun && no_excep_f, Args &&... args)
|
||||||
{
|
{
|
||||||
if (throw_exception)
|
if (throw_exception)
|
||||||
@ -482,13 +482,13 @@ ReturnType readFloatTextImpl(T & x, ReadBuffer & buf)
|
|||||||
return ReturnType(true);
|
return ReturnType(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <typename T>
|
||||||
inline bool tryReadFloatText(T & x, ReadBuffer & buf)
|
inline bool tryReadFloatText(T & x, ReadBuffer & buf)
|
||||||
{
|
{
|
||||||
return readFloatTextImpl<T, bool>(x, buf);
|
return readFloatTextImpl<T, bool>(x, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <typename T>
|
||||||
inline void readFloatText(T & x, ReadBuffer & buf)
|
inline void readFloatText(T & x, ReadBuffer & buf)
|
||||||
{
|
{
|
||||||
readFloatTextImpl<T, void>(x, buf);
|
readFloatTextImpl<T, void>(x, buf);
|
||||||
@ -569,7 +569,7 @@ struct NullSink
|
|||||||
void parseUUID(const UInt8 * src36, UInt8 * dst16);
|
void parseUUID(const UInt8 * src36, UInt8 * dst16);
|
||||||
void parseUUID(const UInt8 * src36, std::reverse_iterator<UInt8 *> dst16);
|
void parseUUID(const UInt8 * src36, std::reverse_iterator<UInt8 *> dst16);
|
||||||
|
|
||||||
template<class IteratorSrc, class IteratorDst>
|
template <typename IteratorSrc, typename IteratorDst>
|
||||||
void formatHex(IteratorSrc src, IteratorDst dst, const size_t num_bytes);
|
void formatHex(IteratorSrc src, IteratorDst dst, const size_t num_bytes);
|
||||||
|
|
||||||
/// In YYYY-MM-DD format
|
/// In YYYY-MM-DD format
|
||||||
|
@ -56,7 +56,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template <class NameParser>
|
template <typename NameParser>
|
||||||
class IParserNameTypePair : public IParserBase
|
class IParserNameTypePair : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
@ -69,7 +69,7 @@ using ParserNameTypePair = IParserNameTypePair<ParserIdentifier>;
|
|||||||
/** Name and type separated by a space. The name can contain a dot. For example, Hits.URL String. */
|
/** Name and type separated by a space. The name can contain a dot. For example, Hits.URL String. */
|
||||||
using ParserCompoundNameTypePair = IParserNameTypePair<ParserCompoundIdentifier>;
|
using ParserCompoundNameTypePair = IParserNameTypePair<ParserCompoundIdentifier>;
|
||||||
|
|
||||||
template <class NameParser>
|
template <typename NameParser>
|
||||||
bool IParserNameTypePair<NameParser>::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
bool IParserNameTypePair<NameParser>::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||||
{
|
{
|
||||||
NameParser name_parser;
|
NameParser name_parser;
|
||||||
@ -101,7 +101,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template <class NameParser>
|
template <typename NameParser>
|
||||||
class IParserColumnDeclaration : public IParserBase
|
class IParserColumnDeclaration : public IParserBase
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
@ -112,7 +112,7 @@ protected:
|
|||||||
using ParserColumnDeclaration = IParserColumnDeclaration<ParserIdentifier>;
|
using ParserColumnDeclaration = IParserColumnDeclaration<ParserIdentifier>;
|
||||||
using ParserCompoundColumnDeclaration = IParserColumnDeclaration<ParserCompoundIdentifier>;
|
using ParserCompoundColumnDeclaration = IParserColumnDeclaration<ParserCompoundIdentifier>;
|
||||||
|
|
||||||
template <class NameParser>
|
template <typename NameParser>
|
||||||
bool IParserColumnDeclaration<NameParser>::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
bool IParserColumnDeclaration<NameParser>::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||||
{
|
{
|
||||||
NameParser name_parser;
|
NameParser name_parser;
|
||||||
|
@ -69,7 +69,7 @@ private:
|
|||||||
|
|
||||||
void checkNamesAndTypesCompatibleWithDictionary(const DictionaryStructure & dictionaryStructure) const;
|
void checkNamesAndTypesCompatibleWithDictionary(const DictionaryStructure & dictionaryStructure) const;
|
||||||
|
|
||||||
template <class ForwardIterator>
|
template <typename ForwardIterator>
|
||||||
std::string generateNamesAndTypesDescription(ForwardIterator begin, ForwardIterator end) const
|
std::string generateNamesAndTypesDescription(ForwardIterator begin, ForwardIterator end) const
|
||||||
{
|
{
|
||||||
if (begin == end)
|
if (begin == end)
|
||||||
|
Loading…
Reference in New Issue
Block a user