Boost logo

Boost :

From: John Hunter (jdhunter_at_[hidden])
Date: 2001-08-16 11:26:58


>>>>> "Peter" == Peter Dimov <pdimov_at_[hidden]> writes:
    Peter> First, boost::mem_fun from <boost/functional.hpp> does not
    Peter> take a boost::shared_ptr. You may use the mem_fun from
    Peter> <boost/mem_fun.hpp> that does (it's part of the Bind
    Peter> library, currently under review.)

I installed bind and it works as advertised. Thanks!

    Peter> Second, your get_ptr_train() function returns a raw pointer
    Peter> to, I assume, Neuron::st. You can't assign this to a
    Peter> boost::shared_ptr<const Train<float_t> >, as you try to do
    Peter> with the transform() call above; even if you could do the
    Peter> assignment, the shared_ptr would try to delete the pointer
    Peter> in its destructor. Your 'trains' array should probably look
    Peter> like

    Peter> std::vector<const Train<float_t> *> trains;

Ok, thanks for the warning.

    Peter> Third, transform'ing into trains.begin() will overwrite the
    Peter> current contents of trains; I don't know whether this is
    Peter> intentional or you'd need back_inserter(trains) instead.

This one is ok: the trains vector is properly sized before the call to
transform.

One thing I noticed with boost/bin/mem_fun.hpp is that I cannot
include boost/functional.hpp since they both define mem_fun in the
boost namespace. Is there any functionality in boost/functional.hpp
that I cannot get in boost/bind/mem_fun.hpp and boost/bind/bind.hpp.
It appears that I have to commit to one or the other. If bind is
accepted after the review process, will it supplant boost::functional
or exist as an alternative?

Thanks again,
John Hunter


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