Thread: templates

  1. #16
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    You mean the C++ standard. As far as I know, C doesn't have namespaces, so you wouldn't have to worry about using directives, now would you?

    I don't particularily like it either, but I think it's preferable to using namespace std.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  2. #17
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Angola
    Posts
    8,435
    Of course it is preferable. It has the merit of at least not defeating entirely the purpose of a namespace.

    If there would be something to wipe out of ones memory, that something would be using namespace std.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #18
    Registered User
    Join Date
    May 2006
    Posts
    630

    Unhappy

    Quote Originally Posted by l2u
    This will allocate P, but how to allocate new datalist.
    Like you do: datalist *temp = new datalist();
    Still no-one answered me?

  4. #19
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    Can't say as I've ever dynamically allocated space for an object of a templated class, but I expect it would be something like this, assuming type t will be type double.

    datalist<double> *temp = new datalist<double>;
    You're only born perfect.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Templates from DLL or static library problem
    By mikahell in forum C++ Programming
    Replies: 2
    Last Post: 01-01-2008, 12:49 AM
  2. Questions about Templates
    By Shamino in forum C++ Programming
    Replies: 4
    Last Post: 12-17-2005, 11:22 PM
  3. templates and inheritance problem
    By kuhnmi in forum C++ Programming
    Replies: 4
    Last Post: 06-14-2004, 02:46 AM
  4. When and when not to use templates
    By *ClownPimp* in forum C++ Programming
    Replies: 7
    Last Post: 07-20-2003, 09:36 AM
Website Security Test