C++ Templates, typedefs, default template parameters
Ruslan Shevchenko
Ruslan@Shevchenko.Kiev.UA
Sat Oct 17 08:24:00 GMT 1998
Jonathan.R.Essex@BankAmerica.com wrote:
>
> I'm sorry if this has been submitted before; If anyone can tell me of a
> _searchable_ archive of this mailing list I will gladly shut up.
>
> I've just downloaded/compiled egcs 1.1b; This is the first time I've
> seriously experimented with any GNU-related compiler. I want to use
> something resembling the standard template library allocators (okay, I may
> be a couple of drafts out of date), which really require the use of default
> template parameters. For example:
>
> template? class T ?
> class allocator
> {
> public:
> typedef T* pointer;
> //etc
> };
>
> template? class T, class A = allocator? T ? ?
> class block
> {
> public:
> typedef A allocator_type;
> typedef allocator_type::pointer pointer_type;
>
according to C++ standart:
typedef typename allocator_type::pointer pointer_type;
> pointer_type pBuffer;
>
> // etc
>
> };
>
> the compiler doesn't complain about the default template parameter (as, to
> be honest, I have come to expect). Instead, it reports:
>
> 'A::pointer' is not a valid declarator.
>
> This would appear to make it impossible to use standard allocators. (yes,
> the strange SGI flavour works fine and is in many senses better but that's
> not what I want; I have a moderately large body of code already written the
> standard way)
>
> All this compiles fine on MSVC 5.0. _HORROR_ Can Microsoft really be
> sticking to a standard more closely than GNU?
>
> Regards,
> Jonathan Essex.
--
@=
//RSSH
mailto:Ruslan@Shevchenko.Kiev.UA
CORBA in Ukraine & ex-USSR: http://www.corbadev.kiev.ua
More information about the Gcc-bugs
mailing list