🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3994

Re: Template Syntax

#3994
From: Rich Paul
Date: Fri, 12 Apr 1996 07:30
44 lines
2129 bytes
> the declaration of operator= was legal, because the use of the token
> "Array" as a return type and a paramter was implicitly treated as if it
> were "Array<T>." Many compilers accept this, but I'm told that several
> reject it, and I can't find language in the January DWP that allows it.
> 

As I implemented the standard string class, I learned that one 
of my compilers accepts this, while another rejects it.  
MSVC4.0 and Borland 5, respectively.  I'd suspect that it a 
recently removed language feature, but for portability, I used 
this:

template < class charT, class traits, class Allocator >
class basic_string 
{
	typedef basic_string<charT, traits, Allocator> self;

	public:
	basic_string ( const self & );
};

The only problem I haven't worked around is that I'd like to 
say:

template<class charT, class traits, class Allocator >
self operator + ( const self &lhs, const self &rhs )
{
	return self ( lhs )+= rhs;
};

Alas, since there is no scope in which to use the typedef, I'm 
stuck with spelling it out ...

Regards,
Rich

(BTW, are you Scott Meyers of More Effective C++ fame?  If so, 
great job!)
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
Technical Details
Message-ID: <316D4ABB.1C7A@trcinc.com>
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
References: <199604102351.QAA11178@netcom15.netcom.com>

Show Full Headers
Complete Article Headers
From: Rich Paul <rpaul@trcinc.com>
Message-ID: <316D4ABB.1C7A@trcinc.com>
X-Original-Date: Thu, 11 Apr 1996 14:08:59 -0400
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
Date: 12 Apr 96 07:30:59 GMT
Approved: fjh@cs.mu.oz.au
Newsgroups: comp.std.c++
Subject: Re: Template Syntax
Organization: Technical Resource Connection
References: <199604102351.QAA11178@netcom15.netcom.com>
X-Mailer: Mozilla 2.01Gold (WinNT; I)
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMW4G2+EDnX0m9pzZAQFrFgF/dBP/r0wnAB4JEQksKwBkhDlY62+mD7cW
 vwr/WYli+srAWp2OH9lFvc+CbHE9It2Q
 =6exD