$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-10-03 15:56:07
At 03:10 PM 10/3/2001, Gennadiy E. Rozental wrote:
 >--- In boost_at_y..., Jens Maurer <Jens.Maurer_at_g...> wrote:
 >> "Gennadiy E. Rozental" wrote:
 >> >
 >> > Hi,
 >> >
 >> > currently checked_delete can't be used with algorithms. For
 >example,
 >> >
 >> > for_each( col.begin(), col.end(), checked_delete<some_type> );
 >>
 >> That works with gcc, and the version below works with Comeau C++ as
 >well.
 >> There's no need for a function object.
 >>
 >> Jens Maurer
 >>
 >>
 >> #include <vector>
 >> #include <algorithm>
 >> #include <boost/utility.hpp>
 >>
 >> 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.
--Beman