Boost logo

Boost :

From: Gennadiy E. Rozental (rogeeff_at_[hidden])
Date: 2001-10-03 14:10:02


--- 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> );
}

I do not rememeber what written in Standard about address of inline
function and instantiation in this case, but MSVC produce following
link error:

test_area.obj : error LNK2001: unresolved external symbol "void
__cdecl boost::checked_delete(int *)" (?
checked_delete_at_boost@@YAXPAH_at_Z)
Debug/test_area.exe : fatal error LNK1120: 1 unresolved externals

Gennadiy.


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