Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-10-17 08:10:51


Hi,
I've just updated my copy of boost-sandbox and start to get the following
error from g++ 3.3:

/space/NM/boost-sandbox/boost/sequence_algo/container_algo.hpp: In function `
   typename boost::container_traits<Container>::const_iterator
   boost::find(const Container&, const T&) [with Container = std::vector<int,
   std::allocator<int> >, T = int]':
../../lib/lvk/program_analysis/dataflow.cpp:145: instantiated from here
/space/NM/boost-sandbox/boost/sequence_algo/container_algo.hpp:150: warning:
cannot
   pass objects of non-POD type `struct
   boost::contiguous_sequence_container_tag' through `...'; call will abort at
   runtime

When I compile the container_algo.cpp test program it produces lots of
similiar warnings, after which I get:

bash-2.05b$ ./a.out
Segmentation fault

Seems like the warning is correct in predicting crash?

I suggest that instead of using "tag" types for determining the right function
to call, the pointer to "tag" is used. I.e. for one fragment one would get:

    template< typename C, typename T >
    inline typename container_traits<C>::iterator
    find_impl( C& c, const T& value, associative_container_tag* ) ...

    template< typename C, typename T >
    inline typename container_traits<C>::iterator
    find_impl( C& c, const T& value, ... ) .....

When I make the change, the test passes. The patch attached. It also fixes
several missing typenames, but the problem is that some of the lines are now
way longer than 80 symbols.

- Volodya




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