🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Dan Kelley Tue, 16 Apr 1996 16:37
how to instantiate sort() in g++ STL?
#922
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads