Menu

New classe proposition

2000-07-13
2000-07-15
  • Raphael Alla

    Raphael Alla - 2000-07-13

    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

     
    • David Sugar

      David Sugar - 2000-07-14

      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...

       
      • Raphael Alla

        Raphael Alla - 2000-07-15

        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)

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.