Boost logo

Boost :

From: Doug Gregor (gregod_at_[hidden])
Date: 2001-05-03 09:54:51


On Thursday 03 May 2001 10:19, you wrote:
> From: "Doug Gregor" <gregod_at_[hidden]>
>
> > On Wednesday 02 May 2001 07:13, you wrote:
> > > Heh, they never had partial ordering rules. :-)
> >
> > It seems to tell the difference betwee function(const Functor) and
> > function(const function&), though barely...
>
> Actually I _think_ that the compiler considers (incorrectly) function(const
> function &) a specialization of function(const Functor); this may explain
> why it doesn't work with 7.0.
>
> > NO_PARTIAL_ORDERING is defined for Intel C++ 5.0 because of this
>
> construct:
> > template<typename R, typename T1>
> > void foo(R (*f)(T1));
> >
> > template<typename Functor>
> > void foo(const Functor &f);
> >
> > Intel C++ 5.0 handles the partial ordering fine unless you try to give it
>
> a
>
> > free function with default arguments, i.e., this code will fail on Intel
> > because it doesn't order between the two foo() templates:
> >
> > int bar(int x, int y = 2);
> > foo(&bar);
>
> Yep, I had a deeper look at the code; the problem exists even for function
> pointers without default arguments. This ordering is almost an advanced C++
> knowledge test.
>
> > Does MSVC 7 actually handle everything if you explicitly use &? I have
> > nothing against documenting that people should write clearer code to make
> > their compiler work :).
>
> It handles everything fine if I use & in every constructor call _and_
> change the constructor to take "Functor const &". With a "const Functor f"
> it cannot find the copy constructor. [I'm not sure whether the assignment
> operator uses a direct assignment or constructs a temporary function, but
> the test passes.]
>
> --
> Peter Dimov
> Multi Media Ltd.

Two questions:
        1) Does the same construct work in MSVC 6.0?
        2) With the addition of &'s in all of the calls, does it pass the regression
tests?

In any case, could you send me a patch/diff/updated version so that I can
merge in the MSVC7 changes?

        Doug


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk