home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17589 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: news.dal.ca!news
  2. From: Dan Kelley <d.kelley@dal.ca>
  3. Newsgroups: gnu.gcc.help,comp.lang.c++
  4. Subject: how to instantiate sort() in g++ STL?
  5. Date: Tue, 16 Apr 1996 13:37:14 -0300
  6. Organization: Dalhousie University
  7. Message-ID: <3173CCBA.78B6@dal.ca>
  8. NNTP-Posting-Host: skye.phys.ocean.dal.ca
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.0 (X11; I; SunOS 5.4 sun4m)
  13.  
  14. Hi.  Can someone help me to templatize the 'sort' STL algorithm?
  15.  
  16. I get linkage errors when I try to compile code with lines like
  17.    vector<double> a;
  18.    // assign stuff into a
  19.    sort(a.begin(), a.end());
  20. The error is that it cannot find "sort(double *, double *)".
  21.  
  22. I compile my files with the -fno-implicit-templates, all except for one file which just
  23. contains lines like
  24.    template class vector<double>;
  25. and so forth.  So I'm wondering whether the correct thing is for me to add some sort of similar
  26. declaration in this file, to let the compiler know what sort() is all about.
  27.  
  28. Please note that using the implicit templates is not a viable solution given the amount of code
  29. I would have to change.
  30.  
  31. Thanks in advance!
  32.  
  33. -- 
  34. Dan E. Kelley                   internet:         mailto:Dan.Kelley@Dal.CA
  35. Oceanography Department         phone:                       (902)494-1694
  36. Dalhousie University            fax:                         (902)494-2885
  37. Halifax, NS, CANADA, B3H 4J1    WWW:  http://www.phys.ocean.dal.ca/~kelley
  38.