Baruch> Attached is a definition of a template that I would like to use, it works Baruch> for my environment (egcs 1.1.2 on a i386 machine - actually an AMD K6). Baruch> What I would like is to have others in different environments and Baruch> different compilers check it (test program enclosed) by compiling it. If Baruch> it works in all required compilers it will help me alot to clean up my Baruch> code. Morning, Baruch attached is a patch to your code that removes most of the errors compiling with DEC cxx. I can do nothing about the non-existence of compose1, select1st or select2nd, however. Angus aleem@pneumon:temp-> cxx -std strict_ansi -O2 -o trial translator_test.C cxx: Error: translator.h, line 58: namespace "std" has no member "compose1" detected during instantiation of "const T2 &Translator<T1, T2>::find(const T1 &) const [with T1=Resize, T2=std::string]" at line 32 of "translator_test.C" std::compose1( ---------------------^ cxx: Error: translator.h, line 61: namespace "std" has no member "select1st" detected during instantiation of "const T2 &Translator<T1, T2>::find(const T1 &) const [with T1=Resize, T2=std::string]" at line 32 of "translator_test.C" std::select1st<MapPair>() -------------------------^ cxx: Error: translator.h, line 61: type name is not allowed detected during instantiation of "const T2 &Translator<T1, T2>::find(const T1 &) const [with T1=Resize, T2=std::string]" at line 32 of "translator_test.C" std::select1st<MapPair>() -----------------------------------^ cxx: Error: translator.h, line 61: expected an expression detected during instantiation of "const T2 &Translator<T1, T2>::find(const T1 &) const [with T1=Resize, T2=std::string]" at line 32 of "translator_test.C" std::select1st<MapPair>() --------------------------------------------^ cxx: Error: translator.h, line 91: namespace "std" has no member "compose1" detected during instantiation of "const T1 &Translator<T1, T2>::find(const T2 &) const [with T1=Resize, T2=std::string]" at line 34 of "translator_test.C" std::compose1( ---------------------^ cxx: Error: translator.h, line 94: namespace "std" has no member "select2nd" detected during instantiation of "const T1 &Translator<T1, T2>::find(const T2 &) const [with T1=Resize, ÿ std::select2nd<MapPair>() -------------------------^ cxx: Error: translator.h, line 94: type name is not allowed detected during instantiation of "const T1 &Translator<T1, T2>::find(const T2 &) const [with T1=Resize, T2=std::string]" at line 34 of "translator_test.C" std::select2nd<MapPair>() -----------------------------------^ cxx: Error: translator.h, line 94: expected an expression detected during instantiation of "const T1 &Translator<T1, T2>::find(const T2 &) const [with T1=Resize, T2=std::string]" at line 34 of "translator_test.C" std::select2nd<MapPair>() --------------------------------------------^
--- /usr/users/aleem/Desktop/translator.h Thu Jul 20 10:35:56 2000 +++ translator.h Thu Jul 20 10:34:23 2000 @@ -14,9 +14,12 @@ #include <vector> -#include <pair.h> // egcs 1.1.2 doesn't have <pair> +//#include <pair.h> // egcs 1.1.2 doesn't have <pair> +#include <utility> // Tru64 unix does not have pair.h! #include <algorithm> #include <functional> + +using std::equal_to; /** This class template is used to translate between two elements, specifically * it was worked out to translate between an enum and strings when reading --- /usr/users/aleem/Desktop/translator_test.C Thu Jul 20 10:35:58 2000 +++ translator_test.C Thu Jul 20 10:29:28 2000 @@ -2,6 +2,10 @@ #include <string> #include <iostream> +using std::string; +using std::cout; +using std::endl; + enum Resize { DEFAULT_SIZE, CM,