This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Idea for more delegations in <algorithm>
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Paolo Carlini <pcarlini at suse dot de>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>, Chris Jefferson <caj at cs dot york dot ac dot uk>
- Date: 23 Mar 2005 17:40:16 +0100
- Subject: Re: Idea for more delegations in <algorithm>
- Organization: Integrable Solutions
- References: <4241980D.7010908@suse.de>
Paolo Carlini <pcarlini@suse.de> writes:
| Hi everyone, hi Chris,
|
| today I got an idea, or better I *read* an idea: do you know N1758?
| Basically, Siek et al., explain at pag. 37 how to to do dispatching
| without tag types. Nothing very exoteric, actually, if you know
| enable_if, but this strikes me as potentially solving at the root the
| optimization problems with empty classes! Because we do *not* have
| additional parameters in the function calls!
|
| For instance, they implement "do the right thing" for vector as:
|
| template<typename InputIterator>
| vector<InputIterator first, InputIterator last,
| typename
| enable_if<(!is_integral<InputIterator>::value), void*>::type = 0);
|
| Or, for some reason, we have troubles with this too? :(
While I've committed my own share of enable-if sins, I've always been
very reluctant to spread it anywhere unless there really is no
acceptable alternative within the language. For vector<>, we already have
the dispatching stuff already in place, so I would not recommend that
approach. (Note too that insert() require the same thing and it is an
ABI change).
-- Gaby