From 2123115009759970042
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,fcf9039f47123dd0
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2004-04-28 08:57:33 PST
Path: archiver1.google.com!news1.google.com!news.glorb.com!news2.euro.net!news2.euro.net!kibo.news.demon.net!mutlu.news.demon.net!demon!mail2news.demon.co.uk!devnull
From: Michiel.Salters@logicacmg.com (Michiel Salters)
Newsgroups: comp.std.c++
Subject: Re: Dear All,
Date: Wed, 28 Apr 2004 15:57:32 +0000 (UTC)
Organization: http://groups.google.com
Lines: 44
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <fcaee77e.0404280424.54399c9a@posting.google.com>
References: <408df3b1$0$436$afc38c87@news.optusnet.com.au>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: mail2news.demon.co.uk 1083167852 16906 10.0.0.1 (28 Apr 2004 15:57:32 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Wed, 28 Apr 2004 15:57:32 +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 1BIrRD-0004OW-00
	for mail2news@news.news.demon.net; Wed, 28 Apr 2004 15:57:31 +0000
X-Received: from mulga.cs.mu.OZ.AU (localhost [127.0.0.1]) by mulga.cs.mu.OZ.AU with ESMTP
	id i3SFvTi2029788; Thu, 29 Apr 2004 01:57:29 +1000 (EST)
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id i3SFvT3C029778;
	Thu, 29 Apr 2004 01:57:29 +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-NNTP-Posting-Date: Wed, 28 Apr 2004 12:24:39 +0000 (UTC)
X-Spamscanner: mailbox1.ucsd.edu  (v1.4 Mar 10 2004 15:18:19, 0.0/5.0 2.63)
X-MailScanner: PASSED (v1.2.8 2351 i3SCOerr012514 mailbox1.ucsd.edu)
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.1 required=5.2 tests=AWL autolearn=no 
	version=2.60-mulga_r1
Xref: archiver1.google.com comp.std.c++:2006

nesotto@cs.auc.dk ("Thorsten Ottosen") wrote in message news:<408df3b1$0$436$afc38c87@news.optusnet.com.au>...
[propoped]
> template< class Vector, class Matrix >
> Vector mean_vector( const Matrix& );
> 
> Matrix m;
> Vector v = mean_vector( m );
> 
> as if mean_vector() returns a proxy with all possible conversion operators
> defined ?
> 
> remark: given a templated conversion operator in a proxy we could
> return the proxy from mean_vector()
> to make it work. However, that incurs a large overhead.

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 */ }
};

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. 

Regards,
Michiel Salters

---
[ 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                       ]



