🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #922

how to instantiate sort() in g++ STL?

#922
From: Dan Kelley
Date: Tue, 16 Apr 1996 16:37
24 lines
1502 bytes
Hi.  Can someone help me to templatize the 'sort' STL algorithm?

I get linkage errors when I try to compile code with lines like
   vector<double> a;
   // assign stuff into a
   sort(a.begin(), a.end());
The error is that it cannot find "sort(double *, double *)".

I compile my files with the -fno-implicit-templates, all except for one file which just
contains lines like
   template class vector<double>;
and so forth.  So I'm wondering whether the correct thing is for me to add some sort of similar
declaration in this file, to let the compiler know what sort() is all about.

Please note that using the implicit templates is not a viable solution given the amount of code
I would have to change.

Thanks in advance!

-- 
Dan E. Kelley                   internet:         mailto:Dan.Kelley@Dal.CA
Oceanography Department         phone:                       (902)494-1694
Dalhousie University            fax:                         (902)494-2885
Halifax, NS, CANADA, B3H 4J1    WWW:  http://www.phys.ocean.dal.ca/~kelley
Technical Details
Message-ID: <3173CCBA.78B6@dal.ca>
Path: arc1-ca.pugleaf.net!news.dal.ca!news

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.dal.ca!news
From: Dan Kelley <d.kelley@dal.ca>
Newsgroups: gnu.gcc.help,comp.lang.c++
Subject: how to instantiate sort() in g++ STL?
Date: Tue, 16 Apr 1996 13:37:14 -0300
Organization: Dalhousie University
Message-ID: <3173CCBA.78B6@dal.ca>
NNTP-Posting-Host: skye.phys.ocean.dal.ca
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 2.0 (X11; I; SunOS 5.4 sun4m)