Fixed slow/fast count selection for size().

This commit is contained in:
John Wellbelove 2016-06-22 21:17:38 +01:00
parent bcae826f4e
commit b0a29ddc3a
3 changed files with 29 additions and 6 deletions

View File

@ -811,14 +811,15 @@ namespace etl
}
else
{
return current_size.count;
return current_size.get_count();
}
}
//*************************************************************************
/// Splice another list into this one.
//*************************************************************************
void splice_after(iterator position, list_type& list)
template <const size_t COUNT_OPTION2>
void splice_after(iterator position, etl::intrusive_forward_list<TValue, TLink, COUNT_OPTION2>& list)
{
// No point splicing to ourself!
if (&list != this)
@ -856,7 +857,8 @@ namespace etl
//*************************************************************************
/// Splice an element from another list into this one.
//*************************************************************************
void splice(iterator position, list_type& list, iterator isource)
template <const size_t COUNT_OPTION2>
void splice(iterator position, etl::intrusive_forward_list<TValue, TLink, COUNT_OPTION2>& list, iterator isource)
{
link_type& before = *position.p_value;
@ -876,7 +878,8 @@ namespace etl
//*************************************************************************
/// Splice a range of elements from another list into this one.
//*************************************************************************
void splice_after(iterator position, list_type& list, iterator begin_, iterator end_)
template <const size_t COUNT_OPTION2>
void splice_after(iterator position, etl::intrusive_forward_list<TValue, TLink, COUNT_OPTION2>& list, iterator begin_, iterator end_)
{
if (!list.empty())
{
@ -1024,6 +1027,11 @@ namespace etl
{
return *this;
}
size_t get_count() const
{
return 0;
}
};
//*************************************************************************
@ -1069,6 +1077,11 @@ namespace etl
return *this;
}
size_t get_count() const
{
return count;
}
size_t count;
};

View File

@ -834,7 +834,7 @@ namespace etl
}
else
{
return current_size.count;
return current_size.get_count();
}
}
@ -1028,6 +1028,11 @@ namespace etl
{
return *this;
}
size_t get_count() const
{
return 0;
}
};
//*************************************************************************
@ -1073,6 +1078,11 @@ namespace etl
return *this;
}
size_t get_count() const
{
return count;
}
size_t count;
};

View File

@ -117,7 +117,7 @@ namespace
//***************************************************************************
typedef etl::intrusive_forward_list<ItemDCNode, FirstLink> DataDC0;
typedef etl::intrusive_forward_list<ItemDCNode, SecondLink> DataDC1;
typedef etl::intrusive_forward_list<ItemNDCNode, FirstLink> DataNDC0;
typedef etl::intrusive_forward_list<ItemNDCNode, FirstLink, etl::count_option::SLOW_COUNT> DataNDC0;
typedef etl::intrusive_forward_list<ItemNDCNode, SecondLink> DataNDC1;
typedef std::vector<ItemNDCNode> InitialDataNDC;