From: Edward Diener (eddielee_at_[hidden])
Date: 2002-08-25 11:15:21
I always though that "int (int,int)" was not a valid type while "int
(*)(int,int)" was a valid type. Are they equivalent to each other ? If so,
is this the way C++ has been for awhile or is it new to the official 1998
C++ standard ?
I think that is the reason I was confused when you altered the syntax to
boost::function to take the entire function type as a single template
parameter as opposed to the return type and parameter types as separate
I would be surprised if any compilers did not recognize the second form and
am surprised that many recognize the first, but if it is valid C++ of course
"Douglas Paul Gregor" <gregod_at_[hidden]> wrote in message
> On Sun, 25 Aug 2002, John Maddock wrote:
> > OK I accept that the syntax you propose is cleaner - but the lib isn't
> > broken with Borland's compiler - it just needs a workaround applying in
> I think this is a classic case of the cure being worse than the disease.
> The workaround doubles the amount of effort, for what purpose?
> Boost.Function still supports the numbered versions for compilers broken
> in this respect, e.g.:
> function2<int, int /*x*/, double /*y*/> foo;
> > Seriously, almost no compilers support the syntax you are using, will
> > actually use boost.function or boost.signals if it just looks as though
> > is broken on all the major compilers?
> EDG-based compilers are fine (tested on Comeau, SGI, Compaq, and Intel),
> as are all versions of GCC from 2.95 on (check the Function tutorial in
> CVS for a list of compilers that have been tested).
> I think this is the case for XFAIL, or at least some form of test
> annotation that can say "this test checks for a specific feature X; the
> library can work without X, but you've been warned". For instance with
> Boost.Function, allocator_test has always failed under MSVC but nobody
> particularly cares because allocators are rarely used (in my
> experience...). Now, function_test will fail on a few compilers, but it
> doesn't hurt users much because they can still use the older alternative
> > One other question: is the syntax you
> > are using actually legal - I refer to the placement of a named parameter
> > within a typename:
> > boost::function<int (int, double)> // no quibbles
> > boost::function<int (int a, double b)> // is this really legal?
> Yeah, it's legal. 8.3.5/8 says:
> "An identifier can optionally be provided as a parameter name; if
> present in a function definition (8.4), it names a parameter (sometimes
> called formal argument )...."
> Unsubscribe & other changes:
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk