Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2001-04-04 19:37:08

A related thought that's been rattling around my brain: there is a whole
category of templates that need to have multiple versions, with arbitrary
numbers of arguments. The kind of templates needed to do complete function
argument deduction are one example. Another example is the that of
"forwarding constructors" for such things as smart pointers (i.e. imagine
you could construct auto_ptr<T> with the arguments that get passed to any of
T's constructors, thereby building the referent). I had to use these all
over the place in the Boost.Python library

Right now, people usually rely on a program to generate these templates for
up to N arguments, where N is some small number. Often, to be able to deal
with const and volatile reference arguments there is a combinatorial
explosion. To deal with these cases effectively would require some kind of
core language change, which, if I could turn back the clock, I would
probably call "template templates". Anyway, I don't really have a good sense
of the syntax for specifying such things, but I know there's a real need
waiting to be filled... somehow.


----- Original Message -----
From: "Matt Austern" <austern_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, April 04, 2001 8:12 PM
Subject: Re: [boost] Re: Is there plans to make stand-alone functor traits?

> David Abrahams wrote:
> > > I wrote a replacement for <functional> several years ago that worked
> > > for function pointers as well, and allowed one to distinguish the
> > > unadorned argument or return type (e.g., foo) from the full argument
> > > or return type (e.g., foo &, foo const &, or foo). If there's any
> > > interest, I can dig it up and post it to the list.
> >
> > Yes! I always been frustrated by having to remember the
> > AdaptableUnaryFunction distinction, and where it was needed... but most
> > all by the fact that I knew it was unneccessary.
> It's on my list for the library extension TR.
> It seems to me that things like extracting the unadorned
> argument are now unnecessary (that's what call_traits and
> the like are for, no?), but a simple functor_traits class,
> no more complicated than iterator_traits, would be
> useful.
> (Actually it has to be a little more complicated than
> iterator_traits, because function pointers are compliated.
> There's the nuisance that if you've got
> void f1();
> extern "C" void f2();,
> then &f1 and &f2 are different types.
> --Matt
> To unsubscribe, send email to: <mailto:boost-unsubscribe_at_[hidden]>
> Your use of Yahoo! Groups is subject to

Boost list run by bdawes at, gregod at, cpdaniel at, john at