egcs1.2, template access

Mumit Khan khan@xraylith.wisc.EDU
Sat Jul 31 23:33:00 GMT 1999


On Thu, 8 Jul 1999, Eric Dumas wrote:

> [Please note I am not on the egcs-bugs list]
> 
> Hello.
> 
>         I have a problem porting code compiling with SunWspro 4.0 (and
> MSC++). The problem is locating in the use of template, and to the
> access to the member of this template.

SunWspro 4.0 and MSC++ are in error.

> The error is "Parse error before ;".
> Egcs v1.1.2 release (2.91.66), linux 2.2.5 - Redhat6.0

See "typename" below.

> 
> 
> template <class ITERATED_CONTAINER, class INDEXED_CONTAINER, class
> +BINARY_TRANSFORM>

I assume the '+' is a typo.

> inline void foo(ITERATED_CONTAINER &destContainer,
>                 const INDEXED_CONTAINER &srcContainer,
>                 SizeT srcLength,
>                 BINARY_TRANSFORM transform)

What is SizeT. Please post complete code for bug reports. Let's say
we typedef that to unsigned int for now.

> {
>         for (SizeT iSource(0) ;
>                 iSource != srcLength ;
>                 ++iSource) {
> 
>                 // This line is not compiling
>                 ITERATED_CONTAINER::value_type elem;

                  typename ITERATED_CONTAINER::value_type elem;
		  ^^^^^^^ Need this. Please see the C++ standard or
		  search for "typename" in any C++ forum for more
		  info.

>         
>                 transform(elem, srcContainer[iSource]);
>                 destContainer.push_bask(elem);
>         }
> }
> 
> -- 
>                  Eric Dumas (dumas@Linux.EU.Org, dumas@freenix.org)
>                           http://www.freenix.org/~dumas/
> -- Linux -- Linux -- Linux -- Linux -- Linux -- Linux -- Linux -- Linux --
> 

Regards,
Mumit




More information about the Gcc-bugs mailing list