mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
Fixed strange code [#CLICKHOUSE-2].
This commit is contained in:
parent
a629039b08
commit
7a60d773ec
@ -76,7 +76,7 @@ protected:
|
||||
}
|
||||
|
||||
template <typename ... TAllocatorParams>
|
||||
void alloc(size_t bytes, TAllocatorParams ... allocator_params)
|
||||
void alloc(size_t bytes, TAllocatorParams &&... allocator_params)
|
||||
{
|
||||
c_start = c_end = reinterpret_cast<char *>(TAllocator::alloc(bytes, std::forward<TAllocatorParams>(allocator_params)...));
|
||||
c_end_of_storage = c_start + bytes - pad_right;
|
||||
@ -91,7 +91,7 @@ protected:
|
||||
}
|
||||
|
||||
template <typename ... TAllocatorParams>
|
||||
void realloc(size_t bytes, TAllocatorParams ... allocator_params)
|
||||
void realloc(size_t bytes, TAllocatorParams &&... allocator_params)
|
||||
{
|
||||
if (c_start == nullptr)
|
||||
{
|
||||
@ -119,7 +119,7 @@ protected:
|
||||
}
|
||||
|
||||
template <typename ... TAllocatorParams>
|
||||
void reserveForNextSize(TAllocatorParams ... allocator_params)
|
||||
void reserveForNextSize(TAllocatorParams &&... allocator_params)
|
||||
{
|
||||
if (size() == 0)
|
||||
realloc(std::max(INITIAL_SIZE, minimum_memory_for_elements(1)), std::forward<TAllocatorParams>(allocator_params)...);
|
||||
@ -207,14 +207,14 @@ public:
|
||||
const_iterator cend() const { return t_end(); }
|
||||
|
||||
template <typename ... TAllocatorParams>
|
||||
void reserve(size_t n, TAllocatorParams ... allocator_params)
|
||||
void reserve(size_t n, TAllocatorParams &&... allocator_params)
|
||||
{
|
||||
if (n > capacity())
|
||||
realloc(roundUpToPowerOfTwoOrZero(minimum_memory_for_elements(n)), std::forward<TAllocatorParams>(allocator_params)...);
|
||||
}
|
||||
|
||||
template <typename ... TAllocatorParams>
|
||||
void resize(size_t n, TAllocatorParams ... allocator_params)
|
||||
void resize(size_t n, TAllocatorParams &&... allocator_params)
|
||||
{
|
||||
reserve(n, std::forward<TAllocatorParams>(allocator_params)...);
|
||||
resize_assume_reserved(n);
|
||||
@ -254,7 +254,7 @@ public:
|
||||
}
|
||||
|
||||
template <typename ... TAllocatorParams>
|
||||
void push_back(const T & x, TAllocatorParams ... allocator_params)
|
||||
void push_back(const T & x, TAllocatorParams &&... allocator_params)
|
||||
{
|
||||
if (unlikely(c_end == c_end_of_storage))
|
||||
reserveForNextSize(std::forward<TAllocatorParams>(allocator_params)...);
|
||||
@ -283,7 +283,7 @@ public:
|
||||
|
||||
/// Do not insert into the array a piece of itself. Because with the resize, the iterators on themselves can be invalidated.
|
||||
template <typename It1, typename It2, typename ... TAllocatorParams>
|
||||
void insert(It1 from_begin, It2 from_end, TAllocatorParams ... allocator_params)
|
||||
void insert(It1 from_begin, It2 from_end, TAllocatorParams &&... allocator_params)
|
||||
{
|
||||
size_t required_capacity = size() + (from_end - from_begin);
|
||||
if (required_capacity > capacity())
|
||||
|
Loading…
Reference in New Issue
Block a user