[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: Re: kdebase/kioslave/sftp
From: Frerich Raabe <frerich.raabe () gmx ! de>
Date: 2004-10-06 13:44:46
Message-ID: 200410061544.47044.frerich.raabe () gmx ! de
[Download RAW message or body]
On Wednesday 06 October 2004 12:05, Nicolas Goutte wrote:
> Well, min and max can only be created in 2 way:
> - by macros (Qt's way)
> - by templates (KDE's way)
In Qt4, both are being used. There are templates, and to avoid the annoying
type warnings there is a bunch of overloads. AFAIK, this is the most portable
solution to solve this problem. The downside of this is that it's dull to
write all those boring overloads, but then - TT does that for us, so why
should we care. :-)
I think passing a second template argument would be even nicer, as in
template <typename T, typename U>
/* ??? */ kMin( T a, U b ) { return a < b ? a : b; }
but the problem is the ??? part, I don't know what to return. :-)
Maybe one can simply always return something of type T - assuming that U can
be converted to a T - but I don't feel comfortable with that really. Maybe
somebody else on this list knows a nice trick to solve this (other than
returning a struct which has a 'Result' typedef referring to the actual type
of the returned value, or equally impractical things).
- Frerich
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic