This is a simple request for the next release.
[1] Adding size method to tree/map/set
vld includes light-weight implementation of STL-like tree/map/set (unfortunately no list, though). I happen to debug vld and found they don't have size method which I think the most primitive one. So, I added it myself by adding m_size member variable as shown below. In the next release, I wish size method is added. It is required when debugging vld.
[tree.h]
template <typename T>
class Tree
{
...
// Constructor
Tree ()
{
...
m_size = 0;
}
// erase
VOID erase (typename Tree::node_t *node)
{
...
m_size--;
}
// insert
typename Tree::node_t* insert (const T &key)
{
...
m_size++;
return node;
}
// size
size_t size()
{
CriticalSectionLocker cs(m_lock);
return m_size;
}
size_t m_size; // Count of nodes
};
[map.h]
template <typename Tk, typename Tv>
class Map {
...
// size
size_t size()
{
return m_tree.size();
}
...
};
[set.h]
template <typename Tk>
class Set {
...
// size
size_t size()
{
return m_tree.size();
}
...
};
[2] looking for light-weight list implementation
Personally, I need this and if someone has such one, please let me know.
My email is ehaerim@gmail.com
Thanks in advance.
Comments: Use std::map, std::set instead of old ones
[1] Adding size method to tree/map/set
vld includes light-weight implementation of STL-like tree/map/set (unfortunately no list, though). I happen to debug vld and found they don't have size method which I think the most primitive one. So, I added it myself by adding m_size member variable as shown below. In the next release, I wish size method is added. It is required when debugging vld.
[tree.h]
template <typename T>
class Tree
{
...
// Constructor
Tree ()
{
...
m_size = 0;
}
// erase
VOID erase (typename Tree::node_t *node)
{
...
m_size--;
}
// insert
typename Tree::node_t* insert (const T &key)
{
...
m_size++;
return node;
}
// size
size_t size()
{
CriticalSectionLocker cs(m_lock);
return m_size;
}
size_t m_size; // Count of nodes
};
[map.h]
template <typename Tk, typename Tv>
class Map {
...
// size
size_t size()
{
return m_tree.size();
}
...
};
[set.h]
template <typename Tk>
class Set {
...
// size
size_t size()
{
return m_tree.size();
}
...
};
[2] looking for light-weight list implementation
Personally, I need this and if someone has such one, please let me know.
My email is ehaerim@gmail.com
Thanks in advance.
Comments: Use std::map, std::set instead of old ones