mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-28 05:18:43 +08:00
Merge remote-tracking branch 'origin/development'
This commit is contained in:
commit
9cfbe76358
@ -429,7 +429,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void pop_front()
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!empty(), ETL_ERROR(basic_intrusive_forward_list_empty));
|
||||
#endif
|
||||
remove_node_after(start_node);
|
||||
}
|
||||
|
||||
|
||||
@ -69,6 +69,8 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
typedef void parameter_type; ///< The type of parameter sent to the function.
|
||||
|
||||
//*************************************************************************
|
||||
/// The function operator that will be overridden.
|
||||
//*************************************************************************
|
||||
@ -154,7 +156,7 @@ namespace etl
|
||||
|
||||
//***************************************************************************
|
||||
///\ingroup function
|
||||
/// Specialisation for static or global functions that take a parameter.
|
||||
/// Specialisation for static or global functions that takes a parameter.
|
||||
//***************************************************************************
|
||||
template <typename TParameter>
|
||||
class function<void, TParameter> : public ifunction<TParameter>
|
||||
|
||||
13
ideque.h
13
ideque.h
@ -1082,7 +1082,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void push_back(parameter_t item)
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
|
||||
#endif
|
||||
create_element_back(item);
|
||||
}
|
||||
|
||||
@ -1094,8 +1096,9 @@ namespace etl
|
||||
reference push_back()
|
||||
{
|
||||
reference r = *_end;
|
||||
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
|
||||
#endif
|
||||
create_element_back();
|
||||
|
||||
return r;
|
||||
@ -1106,7 +1109,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void pop_back()
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!empty(), ETL_ERROR(deque_empty));
|
||||
#endif
|
||||
destroy_element_back();
|
||||
}
|
||||
|
||||
@ -1117,7 +1122,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void push_front(parameter_t item)
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
|
||||
#endif
|
||||
create_element_front(item);
|
||||
}
|
||||
|
||||
@ -1128,7 +1135,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
reference push_front()
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
|
||||
#endif
|
||||
create_element_front();
|
||||
|
||||
return *_begin;
|
||||
@ -1139,7 +1148,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void pop_front()
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!empty(), ETL_ERROR(deque_empty));
|
||||
#endif
|
||||
destroy_element_front();
|
||||
}
|
||||
|
||||
|
||||
@ -411,8 +411,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void push_front()
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
|
||||
|
||||
#endif
|
||||
Data_Node& data_node = allocate_data_node(T());
|
||||
insert_node_after(start_node, data_node);
|
||||
}
|
||||
@ -422,8 +423,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void push_front(parameter_t value)
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
|
||||
|
||||
#endif
|
||||
Data_Node& data_node = allocate_data_node(value);
|
||||
insert_node_after(start_node, data_node);
|
||||
}
|
||||
@ -433,7 +435,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void pop_front()
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!full(), ETL_ERROR(forward_list_empty));
|
||||
#endif
|
||||
remove_node_after(start_node);
|
||||
}
|
||||
|
||||
|
||||
18
ilist.h
18
ilist.h
@ -495,8 +495,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void push_front()
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!full(), ETL_ERROR(list_full));
|
||||
|
||||
#endif
|
||||
Data_Node& data_node = allocate_data_node(T());
|
||||
insert_node(get_head(), data_node);
|
||||
}
|
||||
@ -506,8 +507,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void push_front(parameter_t value)
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!full(), ETL_ERROR(list_full));
|
||||
|
||||
#endif
|
||||
Node& data_node = allocate_data_node(value);
|
||||
insert_node(get_head(), data_node);
|
||||
}
|
||||
@ -517,8 +519,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void pop_front()
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!empty(), ETL_ERROR(list_empty));
|
||||
|
||||
#endif
|
||||
Node& node = get_head();
|
||||
remove_node(node);
|
||||
}
|
||||
@ -528,8 +531,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void push_back()
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!full(), ETL_ERROR(list_full));
|
||||
|
||||
#endif
|
||||
Data_Node& data_node = allocate_data_node(T());
|
||||
insert_node(terminal_node, data_node);
|
||||
}
|
||||
@ -539,8 +543,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void push_back(parameter_t value)
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!full(), ETL_ERROR(list_full));
|
||||
|
||||
#endif
|
||||
Data_Node& data_node = allocate_data_node(value);
|
||||
insert_node(terminal_node, data_node);
|
||||
}
|
||||
@ -550,8 +555,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void pop_back()
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!empty(), ETL_ERROR(list_empty));
|
||||
|
||||
#endif
|
||||
Node& node = get_tail();
|
||||
remove_node(node);
|
||||
}
|
||||
|
||||
@ -454,7 +454,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void pop_front()
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!empty(), ETL_ERROR(intrusive_forward_list_empty));
|
||||
#endif
|
||||
remove_node_after(start_node);
|
||||
}
|
||||
|
||||
|
||||
@ -65,6 +65,7 @@ namespace etl
|
||||
|
||||
typedef T value_type; ///< The type stored in the queue.
|
||||
typedef TContainer container_type; ///< The container type used for priority queue.
|
||||
typedef TCompare compare_type; ///< The comparison type.
|
||||
typedef T& reference; ///< A reference to the type used in the queue.
|
||||
typedef const T& const_reference; ///< A const reference to the type used in the queue.
|
||||
typedef priority_queue_base::size_type size_type; ///< The type used for determining the size of the queue.
|
||||
|
||||
9
iqueue.h
9
iqueue.h
@ -114,8 +114,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void push(parameter_t value)
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!full(), ETL_ERROR(queue_full));
|
||||
|
||||
#endif
|
||||
new(&p_buffer[in]) T(value);
|
||||
in = (in == (MAX_SIZE - 1)) ? 0 : in + 1;
|
||||
++current_size;
|
||||
@ -133,8 +134,9 @@ namespace etl
|
||||
{
|
||||
const size_type next = in;
|
||||
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!full(), ETL_ERROR(queue_full));
|
||||
|
||||
#endif
|
||||
new(&p_buffer[in]) T();
|
||||
in = (in == (MAX_SIZE - 1)) ? 0 : in + 1;
|
||||
++current_size;
|
||||
@ -164,8 +166,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void pop()
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!empty(), ETL_ERROR(queue_empty));
|
||||
|
||||
#endif
|
||||
p_buffer[out].~T();
|
||||
out = (out == (MAX_SIZE - 1)) ? 0 : out + 1;
|
||||
--current_size;
|
||||
|
||||
9
istack.h
9
istack.h
@ -86,8 +86,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void push(parameter_t value)
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!full(), ETL_ERROR(stack_full));
|
||||
|
||||
#endif
|
||||
top_index = current_size++;
|
||||
new(&p_buffer[top_index]) T(value);
|
||||
}
|
||||
@ -101,8 +102,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
reference push()
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!full(), ETL_ERROR(stack_full));
|
||||
|
||||
#endif
|
||||
top_index = current_size++;
|
||||
new(&p_buffer[top_index]) T();
|
||||
|
||||
@ -137,8 +139,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void pop()
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(!empty(), ETL_ERROR(stack_empty));
|
||||
|
||||
#endif
|
||||
p_buffer[top_index].~T();
|
||||
--top_index;
|
||||
--current_size;
|
||||
|
||||
@ -401,7 +401,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void push_back()
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(current_size != MAX_SIZE, ETL_ERROR(vector_full));
|
||||
#endif
|
||||
create_element();
|
||||
}
|
||||
|
||||
@ -412,7 +414,9 @@ namespace etl
|
||||
//*********************************************************************
|
||||
void push_back(parameter_t value)
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(current_size != MAX_SIZE, ETL_ERROR(vector_full));
|
||||
#endif
|
||||
create_element(value);
|
||||
}
|
||||
|
||||
@ -422,7 +426,9 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void pop_back()
|
||||
{
|
||||
#if defined(ETL_CHECK_PUSH_POP)
|
||||
ETL_ASSERT(current_size > 0, ETL_ERROR(vector_empty));
|
||||
#endif
|
||||
destroy_element();
|
||||
}
|
||||
|
||||
|
||||
@ -48,8 +48,8 @@ SOFTWARE.
|
||||
namespace etl
|
||||
{
|
||||
//***************************************************************************
|
||||
///\ingroup queue
|
||||
/// A fixed capacity queue.
|
||||
///\ingroup priority_queue
|
||||
/// A fixed capacity priority queue.
|
||||
/// This queue does not support concurrent access by different threads.
|
||||
/// \tparam T The type this queue should support.
|
||||
/// \tparam SIZE The maximum capacity of the queue.
|
||||
|
||||
@ -324,6 +324,30 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_interface)
|
||||
{
|
||||
typedef etl::priority_queue<int, SIZE> priority_queue_t;
|
||||
priority_queue_t priority_queue;
|
||||
etl::ipriority_queue<int, priority_queue_t::container_type, priority_queue_t::compare_type>& ipriority_queue = priority_queue;
|
||||
|
||||
std::priority_queue<int> compare_priority_queue;
|
||||
|
||||
ipriority_queue.push(1);
|
||||
compare_priority_queue.push(1);
|
||||
|
||||
ipriority_queue.push(2);
|
||||
compare_priority_queue.push(2);
|
||||
|
||||
ipriority_queue.push(3);
|
||||
compare_priority_queue.push(3);
|
||||
|
||||
ipriority_queue.push(4);
|
||||
compare_priority_queue.push(4);
|
||||
CHECK_EQUAL(compare_priority_queue.size(), ipriority_queue.size());
|
||||
CHECK_EQUAL(compare_priority_queue.top(), ipriority_queue.top());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_self_assignment)
|
||||
{
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_THROW_EXCEPTIONS;PLATFORM_WINDOWS;COMPILER_MICROSOFT;ETL_VERBOSE_ERRORS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_THROW_EXCEPTIONS;PLATFORM_WINDOWS;COMPILER_MICROSOFT;ETL_VERBOSE_ERRORS;ETL_CHECK_PUSH_POP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../../../unittest-cpp</AdditionalIncludeDirectories>
|
||||
<UndefinePreprocessorDefinitions>
|
||||
</UndefinePreprocessorDefinitions>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user