Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-10-04 04:52:03


From: "Beman Dawes" <bdawes_at_[hidden]>
> At 03:10 PM 10/3/2001, Gennadiy E. Rozental wrote:
> >--- In boost_at_y..., Jens Maurer <Jens.Maurer_at_g...> wrote:
> >> int main()
> >> {
> >> std::vector<int*> col;
> >> void (*f)(int *) = &boost::checked_delete<int>;
> >> std::for_each( col.begin(), col.end(), f);
> >> }
> >
> >Try original version.
> >
> >#include <vector>
> >#include <algorithm>
> >#include <boost/utility.hpp>
> >
> >int main()
> >{
> > std::vector<int*> col;
> > std::for_each( col.begin(), col.end(),
> >&boost::checked_delete<int> );
> >}
>
> Jens' version passes for Borland, Comeau, Intel, Metrowerks, and Microsoft
> compilers. Fails with internal compiler error on GCC 2.95.2.
>
> Your version passes for Borland, but fails for all the others.

For the record, this is CWG issue #115:

http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_active.html#115

My opinion is that &checked_delete<int> should work. Making it an error will
cripple 'obviously correct' code without reason (that I can see.)

The Microsoft behavior is a bug. The compiler doesn't instantiate the inline
function for some reason.

--
Peter Dimov
Multi Media Ltd.

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