Boost logo

Boost Users :

Subject: [Boost-users] [Function] Potential bug with ref-wrapped function objects?
From: Dave Bonora (dave.bonora_at_[hidden])
Date: 2009-06-03 01:47:41


Hello group,

Boost.Function is exhibiting differing behavior in different boost releases:

//--------------------------

struct F
{
   void operator()() { }
};

F obj; // assume obj remains in scope for duration of sample

boost::function<void()> f1 = boost::ref( obj );
boost::function<void()> f2 = f1;

assert( f1 == boost::ref( obj ) );
assert( f2 == boost::ref( obj ) ); // Passes in 1.35.0, Fails in 1.39.0

boost::function<void()> f3 = boost::ref( obj );
boost::function<void()> f4;

f3.swap( f4 );

assert( f3 != boost::ref( obj ) );
assert( f4 == boost::ref( obj ) ); // Passes in 1.35.0, Fails in 1.39.0

//---------------------------

 I'm assuming 1.35.0 is demonstrating the correct behavior whereas 1.39.0 is
exhibiting a bug,
but I thought I'd defer to the group before I reported it. Am I correct?



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net