The following (template instantiations), lines 48 and 49 of a file (which attached in full)
template void reverse(std::vector<double>::iterator, std::vector<double>::iterator); template void sort(std::vector<double>::iterator, std::vector<double>::iterator compile in g++ 2.96, but they fail in g++ 3.0, with the error message: template.cc:48: non-template used as template template.cc:49: non-template used as template Q: Any advice on how to do this?
// Instantiate templates. // BUG: this code may well need changing as compilers evolve // BUG: in how they handle templates. :=( #define _PUT_STATIC_DATA_MEMBERS_HERE #include <string> #include <vector> // part of STL #include <stdio.h> #include <algorithm> // part of STL #include "gr.hh" #include "defaults.hh" #include "private.hh" #include "types.hh" #include "gr_coll.hh" #include "GriColor.hh" #include "GMatrix.hh" #include "GriState.hh" #include "Synonym.hh" #include "Variable.hh" #if defined(USING_CXX_REPO) template void sort(vector<double>::iterator, vector<double>::iterator); #else // Instantiate on DEC c++ compiler #if defined(__DECCXX) //#pragma define_template void reverse(vector<double>::iterator, vector<double>::iterator); //#pragma define_template void sort(vector<double>::iterator, vector<double>::iterator); #pragma define_template vector<BlockSource> #pragma define_template vector<CmdFile> #pragma define_template vector<DataFile> #pragma define_template vector<GriState> #pragma define_template vector<GriSynonym> #pragma define_template vector<GriVariable> #pragma define_template vector<RpnItem> #pragma define_template vector<bool> #pragma define_template vector<double> #pragma define_template vector<float> #pragma define_template vector<int> #pragma define_template vector<unsigned char> #pragma define_template vector<char*> #pragma define_template GriMatrix<bool> #pragma define_template GriMatrix<double> #endif // DEC compiler // Instantiate on GNU c++ compiler #if defined(__GNUC__) template void reverse(std::vector<double>::iterator, std::vector<double>::iterator); template void sort(std::vector<double>::iterator, std::vector<double>::iterator); template class std::vector<BlockSource>; template class std::vector<CmdFile>; template class std::vector<DataFile>; template class std::vector<GriNamedColor>; template class std::vector<GriState>; template class std::vector<GriSynonym>; template class std::vector<GriVariable>; template class std::vector<RpnItem>; template class std::vector<bool>; template class std::vector<double>; template class std::vector<float>; template class std::vector<int>; template class std::vector<unsigned char>; template class std::vector<char*>; template class GriMatrix<bool>; template class GriMatrix<double>; #endif #endif