From -5076383050877396928
X-Google-Thread: f78e5,d622c2d05233cea8,start
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.speakeasy.net!news.speakeasy.net.POSTED!not-for-mail
NNTP-Posting-Date: Tue, 11 Jul 2006 10:30:20 -0500
Return-Path: <devnull@stump.algebra.com>
X-Authentication-Warning: mulga.csse.unimelb.edu.au: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Original-To: std-c++@mailman.ucar.edu
Delivered-To: std-c++@mailman.ucar.edu
From: "Geo" <gg@remm.org>
Newsgroups: comp.std.c++
Subject: Template members of template class
Organization: http://groups.google.com
Message-ID: <1152613761.862951.8940@35g2000cwc.googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Complaints-To: groups-abuse@google.com
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4,gzip(gfe),gzip(gfe)
X-HTTP-Via: 1.1 S1PS
Complaints-To: groups-abuse@google.com
Injection-Info: 35g2000cwc.googlegroups.com; posting-host=195.33.114.129;
   posting-account=1jTPJQ0AAAC8L70X2o2rFmtB7ewZAKxJ
X-Greylisting: NO DELAY (Relay+Sender autoqualified);
	processed by UCSD_GL-v2.1 on mailbox7.ucsd.edu;
	Tue, 11 July 2006 03:29:29 -0700 (PDT)
X-Spamscanner: mailbox7.ucsd.edu  (v1.6 Jul  6 2006 14:57:05, 0.0/5.0 3.1.3)
X-MailScanner: PASSED (v1.2.8 82079 k6BATShi090225 mailbox7.ucsd.edu)
X-Virus-Scanned: amavisd-new at ucar.edu
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
Date: Tue, 11 Jul 2006 10:23:28 CST
Lines: 48
NNTP-Posting-Host: 65.182.171.162
X-Trace: sv3-6ALUYAWln9NzyfLXt8kjE9v+bjmdcpshbNKux0DiHZb/ewDj1YJ5x07D9WIHHc3T2/0spPUgovh8LBn!7t/k9kcbaNzWcqBpCmm9a5tKEeTFQZnh2kwnzBCEsHguAJdTsIsh+YmJmYYfds/6dwX0LVZKYuza!8Ip6RLZfhBFLieVJmEdoVpZFRUod0TKOuI2tabs=
X-Complaints-To: abuse@speakeasy.net
X-DMCA-Complaints-To: abuse@speakeasy.net
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.32
Xref: g2news2.google.com comp.std.c++:2670

Having spent several hours trying to get the following code to compile
in GCC and failing

namespace test
{

    template<class U, class V=U&> class Formatter__
    {
    private:
	U ss;
    public:

	Formatter__(V out) : ss(out)
	{
	}

	template<typename T> Formatter__& operator<<(const T &item)
	{
	    ss << item;
	    return *this;
	}

	template<> Formatter__& operator<<(const char* s)
	{
            ss << do_stuff(s);
	    return *this;
	}
    };
};

I eventually discovered that it was illegal in standard C++.

My question is, Why ?

I'm not to bothered with the fact that the template specialization
should be at namespace scope, but why can't I specialize operator<<
without specializing Formatter__. What problem does preventing this
solve ?

I can find lots of posts saying it is illegal, but none that explains
why ?

---
[ 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    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]



