MATLAB: How to generate a MEX file from the C++ code that utilizes the SGI standard template library in MATLAB 7.13 (R2011b)

ccompileerrorlibraryMATLABmexsgistandardstltemplate

I have a function written in C++ and would like to generate a MEX file from it to use in MATLAB 7.13 (R2011b). The code uses the old SGI standard template library (STL).
However, when I try to compile, I get numerous errors such as:
.\stl_function.h(146) : warning C4346: '_Predicate::argument_type' : dependent name is not a type
prefix with 'typename' to indicate a type
.\stl_function.h(154) : see reference to class template instantiation 'std::unary_negate<_Predicate>' being compiled
.\stl_function.h(146) : error C2923: 'std::unary_function' : '_Predicate::argument_type' is not a valid template type argument for parameter '_Arg'
.\stl_function.h(146) : error C2955: 'std::unary_function' : use of class template requires template argument list
.\stl_function.h(37) : see declaration of 'std::unary_function'
.\stl_function.h(151) : warning C4346: '_Predicate::argument_type' : dependent name is not a type
prefix with 'typename' to indicate a type
.\stl_function.h(151) : error C2061: syntax error : identifier 'argument_type'
.\iterator.h(38) : fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory
and much more.

Best Answer

The SGI standard template library has not been updated by its developers for more than a decade and is too old to be compiled by recent compilers. It also uses old iostream libraries that are no longer available. None of the supported compilers for MATLAB 7.13 (R2011b) can compile the SGI STL code so the C++ file must be updated to remove dependencies on the SGI STL.
Additionally, supported compilers from older versions of MATLAB are not expected to work either. Only Microsoft Visual C++ 5.0 or SGI 7.1 compilers (from 1997) are tested with the SGI STL library.