I find it usefull in some situation to use instead of a pointer an object which stores a reference and performs some reference counts, so I don't have to worry about freeing the memory for that object.
The Reference template could just do this, and it would allow similar operation than on a pointer (ie operator* and operator->)
I already have some code working that just does this, it could be added to the common C++ library. Let me know if interested
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Regarding templates, I was thinking that using templates could add some flexibility to some already existing common c++ classes.
For instance, consider the class keydata. The current class uses a hash table, which may not be the best option for all applications.
Instead, this class could be made as a template, with a declaration such as:
template <class container=HashTable<string> >
That would greatky reduce the amount of code inside the class, and that would allow to use another stl container (the Map could be used)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
template<typename T> Reference
I find it usefull in some situation to use instead of a pointer an object which stores a reference and performs some reference counts, so I don't have to worry about freeing the memory for that object.
The Reference template could just do this, and it would allow similar operation than on a pointer (ie operator* and operator->)
I already have some code working that just does this, it could be added to the common C++ library. Let me know if interested
Actually, I think it would be a good addition, and may make it worthwhile to consider starting a cc++ "templates" to cover areas missed in the STL...
Regarding templates, I was thinking that using templates could add some flexibility to some already existing common c++ classes.
For instance, consider the class keydata. The current class uses a hash table, which may not be the best option for all applications.
Instead, this class could be made as a template, with a declaration such as:
template <class container=HashTable<string> >
That would greatky reduce the amount of code inside the class, and that would allow to use another stl container (the Map could be used)