mirror of
https://github.com/ETLCPP/etl.git
synced 2026-04-30 19:09:10 +08:00
Re-written to avoid 'undefined behavior' by allowing containers to be polymorphic or not base on a compile time macro.
This commit is contained in:
parent
f9699d3cd4
commit
135506b534
@ -235,6 +235,13 @@ namespace etl
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~string_base()
|
||||
{
|
||||
}
|
||||
|
||||
bool is_truncated; ///< Set to true if the operation truncated the string.
|
||||
size_type current_size; ///< The current number of elements in the string.
|
||||
const size_type CAPACITY; ///< The maximum number of elements in the string.
|
||||
@ -1970,6 +1977,21 @@ namespace etl
|
||||
ibasic_string(const ibasic_string&);
|
||||
|
||||
T* p_buffer;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_STRINGS) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~ibasic_string()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~ibasic_string()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
15
src/bitset.h
15
src/bitset.h
@ -718,6 +718,21 @@ namespace etl
|
||||
const size_t NBITS;
|
||||
const size_t SIZE;
|
||||
element_t* pdata;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_BITSET) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~ibitset()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~ibitset()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
33
src/deque.h
33
src/deque.h
@ -200,6 +200,13 @@ namespace etl
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~deque_base()
|
||||
{
|
||||
}
|
||||
|
||||
size_type current_size; ///< The current number of elements in the deque.
|
||||
const size_type CAPACITY; ///< The maximum number of elements in the deque.
|
||||
const size_type BUFFER_SIZE; ///< The number of elements in the buffer.
|
||||
@ -622,17 +629,6 @@ namespace etl
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~ideque()
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
initialise();
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Assigns a range to the deque.
|
||||
//*************************************************************************
|
||||
@ -1975,6 +1971,21 @@ namespace etl
|
||||
|
||||
// Disable copy construction.
|
||||
ideque(const ideque&);
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_DEQUE) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~ideque()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~ideque()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
@ -108,17 +108,6 @@ namespace etl
|
||||
|
||||
public:
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~iflat_map()
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns an iterator to the beginning of the flat_map.
|
||||
///\return An iterator to the beginning of the flat_map.
|
||||
@ -606,6 +595,21 @@ namespace etl
|
||||
|
||||
/// Internal debugging.
|
||||
etl::debug_count construct_count;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_FLAT_MAP) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~iflat_map()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~iflat_map()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
@ -110,17 +110,6 @@ namespace etl
|
||||
|
||||
public:
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~iflat_multimap()
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns an iterator to the beginning of the flat_multimap.
|
||||
///\return An iterator to the beginning of the flat_multimap.
|
||||
@ -557,6 +546,21 @@ namespace etl
|
||||
|
||||
/// Internal debugging.
|
||||
etl::debug_count construct_count;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_FLAT_MULTIMAP) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~iflat_multimap()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~iflat_multimap()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
@ -86,17 +86,6 @@ namespace etl
|
||||
|
||||
public:
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~iflat_multiset()
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns an iterator to the beginning of the flat_multiset.
|
||||
///\return An iterator to the beginning of the flat_multiset.
|
||||
@ -535,6 +524,21 @@ namespace etl
|
||||
|
||||
/// Internal debugging.
|
||||
etl::debug_count construct_count;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_FLAT_MULTISET) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~iflat_multiset()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~iflat_multiset()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
@ -86,17 +86,6 @@ namespace etl
|
||||
|
||||
public:
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~iflat_set()
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns an iterator to the beginning of the flat_set.
|
||||
///\return An iterator to the beginning of the flat_set.
|
||||
@ -540,6 +529,21 @@ namespace etl
|
||||
|
||||
/// Internal debugging.
|
||||
etl::debug_count construct_count;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_FLAT_SET) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~iflat_set()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~iflat_set()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
@ -222,6 +222,13 @@ namespace etl
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~forward_list_base()
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Get the head node.
|
||||
//*************************************************************************
|
||||
@ -477,17 +484,6 @@ namespace etl
|
||||
|
||||
typedef typename std::iterator_traits<iterator>::difference_type difference_type;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~iforward_list()
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Gets the beginning of the forward_list.
|
||||
//*************************************************************************
|
||||
@ -1343,6 +1339,21 @@ namespace etl
|
||||
|
||||
// Disable copy construction.
|
||||
iforward_list(const iforward_list&);
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_FORWARD_LIST) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~iforward_list()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~iforward_list()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
@ -237,6 +237,13 @@ namespace etl
|
||||
|
||||
size_t current_size; ///< Counts the number of elements in the list.
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor
|
||||
//*************************************************************************
|
||||
~intrusive_forward_list_base()
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Is the intrusive_forward_list a trivial length?
|
||||
//*************************************************************************
|
||||
|
||||
@ -242,6 +242,13 @@ namespace etl
|
||||
|
||||
size_t current_size; ///< Counts the number of elements in the list.
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor
|
||||
//*************************************************************************
|
||||
~intrusive_list_base()
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Is the intrusive_list a trivial length?
|
||||
//*************************************************************************
|
||||
|
||||
@ -181,6 +181,13 @@ namespace etl
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor
|
||||
//*************************************************************************
|
||||
~intrusive_queue_base()
|
||||
{
|
||||
}
|
||||
|
||||
link_type* p_front; ///< The current front of the queue.
|
||||
link_type* p_back; ///< The current back of the queue.
|
||||
|
||||
|
||||
@ -188,6 +188,13 @@ namespace etl
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor
|
||||
//*************************************************************************
|
||||
~intrusive_stack_base()
|
||||
{
|
||||
}
|
||||
|
||||
link_type* p_top; ///< The current top of the stack.
|
||||
|
||||
size_t current_size; ///< Counts the number of elements in the list.
|
||||
|
||||
30
src/list.h
30
src/list.h
@ -306,6 +306,13 @@ namespace etl
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~list_base()
|
||||
{
|
||||
}
|
||||
|
||||
etl::ipool* p_node_pool; ///< The pool of data nodes used in the list.
|
||||
node_t terminal_node; ///< The node that acts as the list start and end.
|
||||
const size_type MAX_SIZE; ///< The maximum size of the list.
|
||||
@ -583,17 +590,6 @@ namespace etl
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~ilist()
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
initialise();
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Gets the beginning of the list.
|
||||
//*************************************************************************
|
||||
@ -1566,6 +1562,18 @@ namespace etl
|
||||
|
||||
// Disable copy construction.
|
||||
ilist(const ilist&);
|
||||
|
||||
#if defined(ETL_POLYMORPHIC_LIST) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~ilist()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~ilist()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
33
src/map.h
33
src/map.h
@ -233,6 +233,13 @@ namespace etl
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor
|
||||
//*************************************************************************
|
||||
~map_base()
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Balance the critical node at the position provided as needed
|
||||
//*************************************************************************
|
||||
@ -801,17 +808,6 @@ namespace etl
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~imap()
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Gets the beginning of the map.
|
||||
//*************************************************************************
|
||||
@ -2007,6 +2003,21 @@ namespace etl
|
||||
|
||||
// Disable copy construction.
|
||||
imap(const imap&);
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_MAP) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~imap()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~imap()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
@ -224,7 +224,13 @@ namespace etl
|
||||
: current_size(0)
|
||||
, CAPACITY(max_size_)
|
||||
, root_node(nullptr)
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// The constructor that is called from derived classes.
|
||||
//*************************************************************************
|
||||
~multimap_base()
|
||||
{
|
||||
}
|
||||
|
||||
@ -952,17 +958,6 @@ namespace etl
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~imultimap()
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Gets the beginning of the multimap.
|
||||
//*************************************************************************
|
||||
@ -1892,6 +1887,22 @@ namespace etl
|
||||
|
||||
// Disable copy construction.
|
||||
imultimap(const imultimap&);
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_MULTIMAP) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~imultimap()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~imultimap()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
@ -226,7 +226,14 @@ namespace etl
|
||||
, root_node(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~multiset_base()
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Attach the provided node to the position provided
|
||||
//*************************************************************************
|
||||
@ -932,17 +939,6 @@ namespace etl
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~imultiset()
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Gets the beginning of the multiset.
|
||||
//*************************************************************************
|
||||
@ -1872,6 +1868,21 @@ namespace etl
|
||||
|
||||
// Disable copy construction.
|
||||
imultiset(const imultiset&);
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_MULTISET) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~imultiset()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~imultiset()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
15
src/pool.h
15
src/pool.h
@ -321,6 +321,21 @@ namespace etl
|
||||
|
||||
const uint32_t ITEM_SIZE; ///< The size of allocated items.
|
||||
const uint32_t MAX_SIZE; ///< The maximum number of objects that can be allocated.
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_POOL) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~ipool()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~ipool()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
@ -154,6 +154,13 @@ namespace etl
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~vector_base()
|
||||
{
|
||||
}
|
||||
|
||||
const size_type CAPACITY; ///<The maximum number of elements in the vector.
|
||||
etl::debug_count construct_count; ///< Internal debugging.
|
||||
};
|
||||
|
||||
34
src/queue.h
34
src/queue.h
@ -164,6 +164,13 @@ namespace etl
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~queue_base()
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Increments (and wraps) the 'in' index value to record a queue addition.
|
||||
//*************************************************************************
|
||||
@ -207,6 +214,7 @@ namespace etl
|
||||
size_type current_size; ///< The number of items in the queue.
|
||||
const size_type CAPACITY; ///< The maximum number of items in the queue.
|
||||
etl::debug_count construct_count; ///< For internal debugging purposes.
|
||||
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
@ -239,17 +247,6 @@ namespace etl
|
||||
|
||||
public:
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~iqueue()
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Gets a reference to the value at the front of the queue.<br>
|
||||
/// \return A reference to the value at the front of the queue.
|
||||
@ -485,6 +482,21 @@ namespace etl
|
||||
iqueue(const iqueue&);
|
||||
|
||||
T* p_buffer; ///< The internal buffer.
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_QUEUE) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~iqueue()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~iqueue()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
@ -854,6 +854,21 @@ namespace etl
|
||||
ireference_flat_map& operator = (const ireference_flat_map&);
|
||||
|
||||
lookup_t& lookup;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_REFERENCE_FLAT_MAP) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~ireference_flat_map()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~ireference_flat_map()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
@ -767,6 +767,21 @@ namespace etl
|
||||
ireference_flat_multimap& operator = (const ireference_flat_multimap&);
|
||||
|
||||
lookup_t& lookup;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_REFERENCE_FLAT_MULTIMAP) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~ireference_flat_multimap()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~ireference_flat_multimap()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
@ -780,6 +780,21 @@ namespace etl
|
||||
ireference_flat_multiset& operator =(const ireference_flat_multiset&);
|
||||
|
||||
lookup_t& lookup;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_REFERENCE_FLAT_MULTISET) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~ireference_flat_multiset()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~ireference_flat_multiset()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
@ -762,6 +762,21 @@ namespace etl
|
||||
ireference_flat_set& operator =(const ireference_flat_set&);
|
||||
|
||||
lookup_t& lookup;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_REFERENCE_FLAT_SET) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~ireference_flat_set()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~ireference_flat_set()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
37
src/set.h
37
src/set.h
@ -227,6 +227,13 @@ namespace etl
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// The constructor that is called from derived classes.
|
||||
//*************************************************************************
|
||||
~set_base()
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Attach the provided node to the position provided
|
||||
//*************************************************************************
|
||||
@ -437,6 +444,7 @@ namespace etl
|
||||
const size_type CAPACITY; ///< The maximum size of the set.
|
||||
Node* root_node; ///< The node that acts as the set root.
|
||||
etl::debug_count construct_count;
|
||||
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
@ -771,8 +779,7 @@ namespace etl
|
||||
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
/// Assignment operator.
|
||||
//*************************************************************************
|
||||
@ -786,17 +793,6 @@ namespace etl
|
||||
return *this;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~iset()
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Gets the beginning of the set.
|
||||
//*************************************************************************
|
||||
@ -1930,6 +1926,21 @@ namespace etl
|
||||
|
||||
// Disable copy construction.
|
||||
iset(const iset&);
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_SET) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~iset()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~iset()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
33
src/stack.h
33
src/stack.h
@ -165,6 +165,13 @@ namespace etl
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~stack_base()
|
||||
{
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Increments the indexes value to record a stack addition.
|
||||
//*************************************************************************
|
||||
@ -230,17 +237,6 @@ namespace etl
|
||||
|
||||
public:
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~istack()
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// Gets a reference to the value at the top of the stack.<br>
|
||||
/// \return A reference to the value at the top of the stack.
|
||||
@ -454,6 +450,21 @@ namespace etl
|
||||
istack(const istack&);
|
||||
|
||||
T* p_buffer; ///< The internal buffer.
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_STACK) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~istack()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~istack()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
@ -480,17 +480,6 @@ namespace etl
|
||||
|
||||
typedef typename std::iterator_traits<iterator>::difference_type difference_type;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~iunordered_map()
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns an iterator to the beginning of the unordered_map.
|
||||
///\return An iterator to the beginning of the unordered_map.
|
||||
@ -1294,6 +1283,21 @@ namespace etl
|
||||
|
||||
/// For library debugging purposes only.
|
||||
etl::debug_count construct_count;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_UNORDERED_MAP) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~iunordered_map()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~iunordered_map()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
@ -480,17 +480,6 @@ namespace etl
|
||||
|
||||
typedef typename std::iterator_traits<iterator>::difference_type difference_type;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~iunordered_multimap()
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns an iterator to the beginning of the unordered_multimap.
|
||||
///\return An iterator to the beginning of the unordered_multimap.
|
||||
@ -1204,6 +1193,21 @@ namespace etl
|
||||
|
||||
/// For library debugging purposes only.
|
||||
etl::debug_count construct_count;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_UNORDERED_MULTIMAP) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~iunordered_multimap()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~iunordered_multimap()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
@ -475,17 +475,6 @@ namespace etl
|
||||
|
||||
typedef typename std::iterator_traits<iterator>::difference_type difference_type;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~iunordered_multiset()
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns an iterator to the beginning of the unordered_multiset.
|
||||
///\return An iterator to the beginning of the unordered_multiset.
|
||||
@ -1198,6 +1187,21 @@ namespace etl
|
||||
|
||||
/// For library debugging purposes only.
|
||||
etl::debug_count construct_count;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_UNORDERED_MULTISET) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~iunordered_multiset()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~iunordered_multiset()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
@ -476,17 +476,6 @@ namespace etl
|
||||
|
||||
typedef typename std::iterator_traits<iterator>::difference_type difference_type;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~iunordered_set()
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns an iterator to the beginning of the unordered_set.
|
||||
///\return An iterator to the beginning of the unordered_set.
|
||||
@ -1175,6 +1164,21 @@ namespace etl
|
||||
|
||||
/// For library debugging purposes only.
|
||||
etl::debug_count construct_count;
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_UNORDERED_SET) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~iunordered_set()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~iunordered_set()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
26
src/vector.h
26
src/vector.h
@ -93,17 +93,6 @@ namespace etl
|
||||
|
||||
public:
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
~ivector()
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns an iterator to the beginning of the vector.
|
||||
///\return An iterator to the beginning of the vector.
|
||||
@ -968,6 +957,21 @@ namespace etl
|
||||
|
||||
// Disable copy construction.
|
||||
ivector(const ivector&);
|
||||
|
||||
//*************************************************************************
|
||||
/// Destructor.
|
||||
//*************************************************************************
|
||||
#if defined(ETL_POLYMORPHIC_VECTOR) || defined(ETL_POLYMORPHIC_CONTAINERS)
|
||||
public:
|
||||
virtual ~ivector()
|
||||
{
|
||||
}
|
||||
#else
|
||||
protected:
|
||||
~ivector()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
@ -99,6 +99,9 @@ namespace
|
||||
|
||||
int current_count = NDC::get_instance_count();
|
||||
|
||||
DataNDC* p = new DataNDC(INITIAL_SIZE, INITIAL_VALUE);
|
||||
delete p;
|
||||
|
||||
DataNDC* pdata = new DataNDC(INITIAL_SIZE, INITIAL_VALUE);
|
||||
CHECK_EQUAL(int(current_count + INITIAL_SIZE), NDC::get_instance_count());
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user