Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2008-02-26 15:50:19


Yingwei Zhang:

> HI, in my spirit grammar file, I use boost::bind to bind a template
> function:
> boos::bind(&std::vector<uint32_t>::push_back)(my_vector, i);
>
> This compiles fine. However, since this is the only usage of
> std::vector<uint32_t>::push_back, this function is not instantiated and
> linker complains that this function is not defined.

This is an unfortunate compiler bug. You can force the instantiation of the
function by using

    typedef std::vector<uint32_t> V;
    void (V::*pm)( uint32_t const& ) = &V::push_back;

    boost::bind( pm, ... );

but it's somewhat clumsy. I know of no other fix apart from upgrading your
compiler.


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