From 6010766297045274417
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,fcf9039f47123dd0
X-Google-Attributes: gidf78e5,public
Path: controlnews3.google.com!news1.google.com!news.glorb.com!fr.ip.ndsoftware.net!proxad.net!proxad.net!194.159.246.34.MISMATCH!kibo.news.demon.net!mutlu.news.demon.net!demon!mail2news.demon.co.uk!devnull
From: nesotto@cs.auc.dk ("Thorsten Ottosen")
Newsgroups: comp.std.c++
Subject: Re: Dear All,
Date: Fri, 30 Apr 2004 03:14:41 +0000 (UTC)
Lines: 43
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <4090476b$0$25012$afc38c87@news.optusnet.com.au>
References: <408df3b1$0$436$afc38c87@news.optusnet.com.au> <fcaee77e.0404280424.54399c9a@posting.google.com>
X-Trace: mail2news.demon.co.uk 1083294881 12759 10.0.0.1 (30 Apr 2004 03:14:41 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Fri, 30 Apr 2004 03:14:41 +0000 (UTC)
X-Received: from mulga.cs.mu.oz.au ([128.250.1.22])
	by news.demon.co.uk with esmtp (Exim 4.12)
	id 1BJOU4-0003Je-00
	for mail2news@news.news.demon.net; Fri, 30 Apr 2004 03:14:41 +0000
X-Received: from mulga.cs.mu.OZ.AU (localhost [127.0.0.1]) by mulga.cs.mu.OZ.AU with ESMTP
	id i3U3Eai2016854; Fri, 30 Apr 2004 13:14:36 +1000 (EST)
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id i3U3Ea0E016844;
	Fri, 30 Apr 2004 13:14:36 +1000 (EST)
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Path: comp-std-cpp-robomod!not-for-mail
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Delivered-To: std-c++@ucar.edu
X-Newsgroups: comp.std.c++
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.60-mulga_r1 (1.212-2003-09-23-exp) on 
	mulga.cs.mu.OZ.AU
X-Spam-Status: No, hits=0.7 required=5.2 tests=AWL,PRIORITY_NO_NAME 
	autolearn=no version=2.60-mulga_r1
Xref: controlnews3.google.com comp.std.c++:21

"Michiel Salters" <Michiel.Salters@logicacmg.com> wrote in message
news:fcaee77e.0404280424.54399c9a@posting.google.com...
[snip]
| Why would there be a large overhead?
| template< typename Matrix >
| class mean_vector_return<Matrix> {
|   friend mean_vector_return( Matrix const& argument );
|   Matrix const& argument;
| public:
|   template< typename Vector >
|   operator Vector() { /* real implementation */ }
| };

I see, clever :-)

| template< typename Matrix >
| inline mean_vector_return<Matrix> mean_vector( Matrix const& argument )
| {
|   return mean_vector_return<Matrix>( argument );
| }
| Basically, everything except the operator T could be inlined. The
| operator Vector actually implements the intended
| mean_vector<Matrix,Vector>() function.

I guess it works then, but it leaves some issues:

1. it seems quite strange to put the implementation in a conversion operator
instead of in the function body
2. all function prototypes would have to look like
    template< class T >
    foo_return<T> foo( T const& );

br

Thorsten


---
[ 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.jamesd.demon.co.uk/csc/faq.html                       ]



