mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-18 01:46:08 +08:00
Removed C++ 03 incompatibilities.
This commit is contained in:
parent
622c949aee
commit
be012991cb
130
src/ideque.h
130
src/ideque.h
@ -1249,24 +1249,7 @@ namespace etl
|
||||
//*********************************************************************
|
||||
/// Create a new element with a default value at the front.
|
||||
//*********************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<etl::is_fundamental<U>::value, void>::type
|
||||
create_element_front()
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
--_begin;
|
||||
}
|
||||
|
||||
++current_size;
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Create a new element with a default value at the front.
|
||||
//*********************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<!etl::is_fundamental<U>::value, void>::type
|
||||
create_element_front()
|
||||
void create_element_front()
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
@ -1281,40 +1264,7 @@ namespace etl
|
||||
/// Create a new elements from a range at the front.
|
||||
//*********************************************************************
|
||||
template <typename TIterator>
|
||||
typename etl::enable_if<etl::is_fundamental<typename std::iterator_traits<TIterator>::value_type>::value, void>::type
|
||||
create_element_front(size_t n, TIterator from)
|
||||
{
|
||||
if (n == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty())
|
||||
{
|
||||
--_begin;
|
||||
--n;
|
||||
}
|
||||
|
||||
if (n > 0)
|
||||
{
|
||||
_begin -= n;
|
||||
}
|
||||
|
||||
iterator item = _begin;
|
||||
|
||||
do
|
||||
{
|
||||
*item++ = *from++;
|
||||
++current_size;
|
||||
} while (n-- != 0);
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Create a new elements from a range at the front.
|
||||
//*********************************************************************
|
||||
template <typename TIterator>
|
||||
typename etl::enable_if<!etl::is_fundamental<typename std::iterator_traits<TIterator>::value_type>::value, void>::type
|
||||
create_element_front(size_t n, TIterator from)
|
||||
void create_element_front(size_t n, TIterator from)
|
||||
{
|
||||
if (n == 0)
|
||||
{
|
||||
@ -1345,20 +1295,7 @@ namespace etl
|
||||
//*********************************************************************
|
||||
/// Create a new element with a default value at the back.
|
||||
//*********************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<etl::is_fundamental<U>::value, void>::type
|
||||
create_element_back()
|
||||
{
|
||||
++_end;
|
||||
++current_size;
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Create a new element with a default value at the back.
|
||||
//*********************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<!etl::is_fundamental<U>::value, void>::type
|
||||
create_element_back()
|
||||
void create_element_back()
|
||||
{
|
||||
new(&(*_end)) T();
|
||||
++_end;
|
||||
@ -1368,20 +1305,7 @@ namespace etl
|
||||
//*********************************************************************
|
||||
/// Create a new element with a default value at the front.
|
||||
//*********************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<etl::is_fundamental<U>::value, void>::type
|
||||
create_element_front(parameter_t value)
|
||||
{
|
||||
--_begin;
|
||||
++current_size;
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Create a new element with a default value at the front.
|
||||
//*********************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<!etl::is_fundamental<U>::value, void>::type
|
||||
create_element_front(parameter_t value)
|
||||
void create_element_front(parameter_t value)
|
||||
{
|
||||
--_begin;
|
||||
new(&(*_begin)) T(value);
|
||||
@ -1391,21 +1315,7 @@ namespace etl
|
||||
//*********************************************************************
|
||||
/// Create a new element with a value at the back
|
||||
//*********************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<etl::is_fundamental<U>::value, void>::type
|
||||
create_element_back(parameter_t value)
|
||||
{
|
||||
*_end = value;
|
||||
++_end;
|
||||
++current_size;
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Create a new element with a value at the back
|
||||
//*********************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<!etl::is_fundamental<U>::value, void>::type
|
||||
create_element_back(parameter_t value)
|
||||
void create_element_back(parameter_t value)
|
||||
{
|
||||
new(&(*_end)) T(value);
|
||||
++_end;
|
||||
@ -1415,20 +1325,7 @@ namespace etl
|
||||
//*********************************************************************
|
||||
/// Destroy an element at the front.
|
||||
//*********************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<etl::is_fundamental<U>::value, void>::type
|
||||
destroy_element_front()
|
||||
{
|
||||
--current_size;
|
||||
++_begin;
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Destroy an element at the front.
|
||||
//*********************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<!etl::is_fundamental<U>::value, void>::type
|
||||
destroy_element_front()
|
||||
void destroy_element_front()
|
||||
{
|
||||
(*_begin).~T();
|
||||
--current_size;
|
||||
@ -1438,20 +1335,7 @@ namespace etl
|
||||
//*********************************************************************
|
||||
/// Destroy an element at the back.
|
||||
//*********************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<etl::is_fundamental<U>::value, void>::type
|
||||
destroy_element_back()
|
||||
{
|
||||
--_end;
|
||||
--current_size;
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Destroy an element at the back.
|
||||
//*********************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<!etl::is_fundamental<U>::value, void>::type
|
||||
destroy_element_back()
|
||||
void destroy_element_back()
|
||||
{
|
||||
--_end;
|
||||
(*_end).~T();
|
||||
|
||||
93
src/ipool.h
93
src/ipool.h
@ -46,7 +46,7 @@ namespace etl
|
||||
//***************************************************************************
|
||||
template <typename T>
|
||||
class ipool : public pool_base
|
||||
{
|
||||
{
|
||||
public:
|
||||
|
||||
typedef T value_type;
|
||||
@ -319,9 +319,7 @@ namespace etl
|
||||
/// etl::pool_no_allocation if thrown, otherwise a nullptr is returned.
|
||||
/// \note The state of the object returned is undefined.
|
||||
//*************************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<etl::is_fundamental<U>::value, T*>::type
|
||||
allocate()
|
||||
T* allocate()
|
||||
{
|
||||
#if defined(_DEBUG) || defined(DEBUG)
|
||||
ETL_ASSERT(items_allocated < MAX_SIZE && !in_use_flags.test(next_free), ETL_ERROR(pool_no_allocation));
|
||||
@ -329,70 +327,22 @@ namespace etl
|
||||
ETL_ASSERT(items_allocated < MAX_SIZE, ETL_ERROR(pool_no_allocation));
|
||||
#endif
|
||||
|
||||
T* result = &p_buffer[next_free];
|
||||
in_use_flags.set(next_free);
|
||||
next_free = in_use_flags.find_first(false);
|
||||
++items_allocated;
|
||||
return result;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Allocate an object from the pool.
|
||||
/// Uses the default constructor.
|
||||
/// If asserts or exceptions are enabled and there are no more free items an
|
||||
/// etl::pool_no_allocation if thrown, otherwise a nullptr is returned.
|
||||
/// \note The state of the object returned is undefined.
|
||||
//*************************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<!etl::is_fundamental<U>::value, T*>::type
|
||||
allocate()
|
||||
{
|
||||
#if defined(_DEBUG) || defined(DEBUG)
|
||||
ETL_ASSERT(items_allocated < MAX_SIZE && !in_use_flags.test(next_free), ETL_ERROR(pool_no_allocation));
|
||||
#else
|
||||
ETL_ASSERT(items_allocated < MAX_SIZE, ETL_ERROR(pool_no_allocation));
|
||||
#endif
|
||||
|
||||
T* result = new(&p_buffer[next_free]) T();
|
||||
in_use_flags.set(next_free);
|
||||
next_free = in_use_flags.find_first(false);
|
||||
++items_allocated;
|
||||
return result;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Allocate an object from the pool from an ititial value.
|
||||
/// If asserts or exceptions are enabled and there are no more free items an
|
||||
/// etl::pool_no_allocation if thrown, otherwise a nullptr is returned.
|
||||
/// \note The state of the object returned is undefined.
|
||||
//*************************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<etl::is_fundamental<U>::value, T*>::type
|
||||
allocate(const T& initial)
|
||||
{
|
||||
#if defined(_DEBUG) || defined(DEBUG)
|
||||
ETL_ASSERT(items_allocated < MAX_SIZE && !in_use_flags.test(next_free), ETL_ERROR(pool_no_allocation));
|
||||
#else
|
||||
ETL_ASSERT(items_allocated < MAX_SIZE, ETL_ERROR(pool_no_allocation));
|
||||
#endif
|
||||
|
||||
T* result = &p_buffer[next_free];
|
||||
*result = initial;
|
||||
in_use_flags.set(next_free);
|
||||
next_free = in_use_flags.find_first(false);
|
||||
++items_allocated;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Allocate an object from the pool from an ititial value.
|
||||
/// Allocate an object from the pool from an initial value.
|
||||
/// If asserts or exceptions are enabled and there are no more free items an
|
||||
/// etl::pool_no_allocation if thrown, otherwise a nullptr is returned.
|
||||
/// \note The state of the object returned is undefined.
|
||||
//*************************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<!etl::is_fundamental<U>::value, T*>::type
|
||||
allocate(const T& initial)
|
||||
T* allocate(const T& initial)
|
||||
{
|
||||
#if defined(_DEBUG) || defined(DEBUG)
|
||||
ETL_ASSERT(items_allocated < MAX_SIZE && !in_use_flags.test(next_free), ETL_ERROR(pool_no_allocation));
|
||||
@ -401,9 +351,11 @@ namespace etl
|
||||
#endif
|
||||
|
||||
T* result = new(&p_buffer[next_free]) T(initial);
|
||||
|
||||
in_use_flags.set(next_free);
|
||||
next_free = in_use_flags.find_first(false);
|
||||
++items_allocated;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -424,9 +376,7 @@ namespace etl
|
||||
/// pool then an etl::pool_object_not_in_pool is thrown.
|
||||
/// \param p_object A pointer to the object to be released.
|
||||
//*************************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<etl::is_fundamental<U>::value, void>::type
|
||||
release(const T* const p_object)
|
||||
void release(const T* const p_object)
|
||||
{
|
||||
// Does it belong to me?
|
||||
ETL_ASSERT(is_in_pool(p_object), ETL_ERROR(pool_object_not_in_pool));
|
||||
@ -435,33 +385,6 @@ namespace etl
|
||||
typename std::iterator_traits<T*>::difference_type distance = p_object - p_buffer;
|
||||
size_t index = static_cast<size_t>(distance);
|
||||
|
||||
// Check that it hasn't already been released.
|
||||
if (in_use_flags.test(index))
|
||||
{
|
||||
// Destroy the object and mark as available.
|
||||
in_use_flags.reset(index);
|
||||
--items_allocated;
|
||||
next_free = index;
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Release an object in the pool.
|
||||
/// If asserts or exceptions are enabled and the object does not belong to this
|
||||
/// pool then an etl::pool_object_not_in_pool is thrown.
|
||||
/// \param p_object A pointer to the object to be released.
|
||||
//*************************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<!etl::is_fundamental<U>::value, void>::type
|
||||
release(const T* const p_object)
|
||||
{
|
||||
// Does it belong to me?
|
||||
ETL_ASSERT(is_in_pool(p_object), ETL_ERROR(pool_object_not_in_pool));
|
||||
|
||||
// Where is it in the buffer?
|
||||
typename std::iterator_traits<T*>::difference_type distance = p_object - p_buffer;
|
||||
size_t index = static_cast<size_t>(distance);
|
||||
|
||||
// Check that it hasn't already been released.
|
||||
if (in_use_flags.test(index))
|
||||
{
|
||||
|
||||
89
src/iqueue.h
89
src/iqueue.h
@ -112,27 +112,7 @@ namespace etl
|
||||
/// otherwise does nothing if full.
|
||||
///\param value The value to push to the queue.
|
||||
//*************************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<etl::is_fundamental<U>::value, void>::type
|
||||
push(parameter_t value)
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!full(), ETL_ERROR(queue_full));
|
||||
#endif
|
||||
p_buffer[in] = value;
|
||||
in = (in == (MAX_SIZE - 1)) ? 0 : in + 1;
|
||||
++current_size;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Adds a value to the queue.
|
||||
/// If asserts or exceptions are enabled, throws an etl::queue_full is the queue is already full,
|
||||
/// otherwise does nothing if full.
|
||||
///\param value The value to push to the queue.
|
||||
//*************************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<!etl::is_fundamental<U>::value, void>::type
|
||||
push(parameter_t value)
|
||||
void push(parameter_t value)
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!full(), ETL_ERROR(queue_full));
|
||||
@ -150,32 +130,7 @@ namespace etl
|
||||
/// otherwise does nothing if full.
|
||||
/// \return A reference to the position to 'push' to.
|
||||
//*************************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<etl::is_fundamental<U>::value, reference>::type
|
||||
push()
|
||||
{
|
||||
const size_type next = in;
|
||||
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!full(), ETL_ERROR(queue_full));
|
||||
#endif
|
||||
in = (in == (MAX_SIZE - 1)) ? 0 : in + 1;
|
||||
++current_size;
|
||||
|
||||
return p_buffer[next];
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Allows a possibly more efficient 'push' by moving to the next input value
|
||||
/// and returning a reference to it.
|
||||
/// This may eliminate a copy by allowing direct construction in-place.<br>
|
||||
/// If asserts or exceptions are enabled, throws an etl::queue_full is the queue is already full,
|
||||
/// otherwise does nothing if full.
|
||||
/// \return A reference to the position to 'push' to.
|
||||
//*************************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<!etl::is_fundamental<U>::value, reference>::type
|
||||
push()
|
||||
reference push()
|
||||
{
|
||||
const size_type next = in;
|
||||
|
||||
@ -192,26 +147,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Clears the queue to the empty state.
|
||||
//*************************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<etl::is_fundamental<U>::value, void>::type
|
||||
clear()
|
||||
{
|
||||
while (current_size > 0)
|
||||
{
|
||||
out = (out == (MAX_SIZE - 1)) ? 0 : out + 1;
|
||||
--current_size;
|
||||
}
|
||||
|
||||
in = 0;
|
||||
out = 0;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Clears the queue to the empty state.
|
||||
//*************************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<!etl::is_fundamental<U>::value, void>::type
|
||||
clear()
|
||||
void clear()
|
||||
{
|
||||
while (current_size > 0)
|
||||
{
|
||||
@ -228,24 +164,7 @@ namespace etl
|
||||
/// Removes the oldest value from the back of the queue.
|
||||
/// Does nothing if the queue is already empty.
|
||||
//*************************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<etl::is_fundamental<U>::value, void>::type
|
||||
pop()
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!empty(), ETL_ERROR(queue_empty));
|
||||
#endif
|
||||
out = (out == (MAX_SIZE - 1)) ? 0 : out + 1;
|
||||
--current_size;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Removes the oldest value from the back of the queue.
|
||||
/// Does nothing if the queue is already empty.
|
||||
//*************************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<!etl::is_fundamental<U>::value, void>::type
|
||||
pop()
|
||||
void pop()
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!empty(), ETL_ERROR(queue_empty));
|
||||
|
||||
80
src/istack.h
80
src/istack.h
@ -84,25 +84,7 @@ namespace etl
|
||||
/// If asserts or exceptions are enabled, throws an etl::stack_full is the stack is already full.
|
||||
///\param value The value to push to the stack.
|
||||
//*************************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<etl::is_fundamental<U>::value, void>::type
|
||||
push(parameter_t value)
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!full(), ETL_ERROR(stack_full));
|
||||
#endif
|
||||
top_index = current_size++;
|
||||
p_buffer[top_index] = value;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Adds a value to the stack.
|
||||
/// If asserts or exceptions are enabled, throws an etl::stack_full is the stack is already full.
|
||||
///\param value The value to push to the stack.
|
||||
//*************************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<!etl::is_fundamental<U>::value, void>::type
|
||||
push(parameter_t value)
|
||||
void push(parameter_t value)
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!full(), ETL_ERROR(stack_full));
|
||||
@ -118,28 +100,7 @@ namespace etl
|
||||
/// If asserts or exceptions are enabled, throws an etl::stack_full is the stack is already full.
|
||||
/// \return A reference to the position to 'push' to.
|
||||
//*************************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<etl::is_fundamental<U>::value, reference>::type
|
||||
push()
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!full(), ETL_ERROR(stack_full));
|
||||
#endif
|
||||
top_index = current_size++;
|
||||
|
||||
return p_buffer[top_index];
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Allows a possibly more efficient 'push' by moving to the next input value
|
||||
/// and returning a reference to it.
|
||||
/// This may eliminate a copy by allowing direct construction in-place.<br>
|
||||
/// If asserts or exceptions are enabled, throws an etl::stack_full is the stack is already full.
|
||||
/// \return A reference to the position to 'push' to.
|
||||
//*************************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<!etl::is_fundamental<U>::value, reference>::type
|
||||
push()
|
||||
reference push()
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!full(), ETL_ERROR(stack_full));
|
||||
@ -162,23 +123,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Clears the stack to the empty state.
|
||||
//*************************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<etl::is_fundamental<U>::value, void>::type
|
||||
clear()
|
||||
{
|
||||
while (current_size > 0)
|
||||
{
|
||||
--top_index;
|
||||
--current_size;
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Clears the stack to the empty state.
|
||||
//*************************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<!etl::is_fundamental<U>::value, void>::type
|
||||
clear()
|
||||
void clear()
|
||||
{
|
||||
while (current_size > 0)
|
||||
{
|
||||
@ -192,24 +137,7 @@ namespace etl
|
||||
/// Removes the oldest item from the top of the stack.
|
||||
/// Does nothing if the stack is already empty.
|
||||
//*************************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<etl::is_fundamental<U>::value, void>::type
|
||||
pop()
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!empty(), ETL_ERROR(stack_empty));
|
||||
#endif
|
||||
--top_index;
|
||||
--current_size;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Removes the oldest item from the top of the stack.
|
||||
/// Does nothing if the stack is already empty.
|
||||
//*************************************************************************
|
||||
template <typename U = T>
|
||||
typename etl::enable_if<!etl::is_fundamental<U>::value, void>::type
|
||||
pop()
|
||||
void pop()
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!empty(), ETL_ERROR(stack_empty));
|
||||
|
||||
@ -76,13 +76,6 @@ namespace etl
|
||||
|
||||
typedef typename parameter_type<T>::type parameter_t;
|
||||
|
||||
private:
|
||||
|
||||
template <typename U>
|
||||
struct no_construct : integral_constant<bool, etl::is_fundamental<U>::value || etl::is_pointer<U>::value>
|
||||
{
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
//*********************************************************************
|
||||
@ -659,14 +652,7 @@ namespace etl
|
||||
//*********************************************************************
|
||||
void create_element()
|
||||
{
|
||||
if (no_construct<T>::value)
|
||||
{
|
||||
current_size++;
|
||||
}
|
||||
else
|
||||
{
|
||||
new(&p_buffer[current_size++]) T();
|
||||
}
|
||||
new(&p_buffer[current_size++]) T();
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
@ -674,14 +660,7 @@ namespace etl
|
||||
//*********************************************************************
|
||||
void create_element(parameter_t value)
|
||||
{
|
||||
if (no_construct<T>::value)
|
||||
{
|
||||
p_buffer[current_size++] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
new(&p_buffer[current_size++]) T(value);
|
||||
}
|
||||
new(&p_buffer[current_size++]) T(value);
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
@ -689,14 +668,7 @@ namespace etl
|
||||
//*********************************************************************
|
||||
void create_element_at(size_t index, parameter_t value)
|
||||
{
|
||||
if (no_construct<T>::value)
|
||||
{
|
||||
p_buffer[index] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
new(&p_buffer[index]) T(value);
|
||||
}
|
||||
new(&p_buffer[index]) T(value);
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
@ -704,14 +676,7 @@ namespace etl
|
||||
//*********************************************************************
|
||||
void destroy_element()
|
||||
{
|
||||
if (no_construct<T>::value)
|
||||
{
|
||||
--current_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
p_buffer[--current_size].~T();
|
||||
}
|
||||
p_buffer[--current_size].~T();
|
||||
}
|
||||
|
||||
// Disable copy construction.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user