Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Taking bets on when ISO C will acquire a form of templates, or taking it in even more generic direction - parametrized namespaces. Something like this (an illustrative example, don't knock me down for including val into list):

  namespace(T)
  {
    struct list
    {
       T      val;
       list * next;
       list * prev;
    };

    void append(list * l, list * i)
    {
      ...
    }
  }
Then

  list<int> * foo, * bar;
  ...
  append(foo, bar);
No need for namespace nesting, default arguments and other ++isms. Just something to replace multi-line macro blocks.


Why not just use C++ without namespace nesting, default arguments, and other ++isms?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: