Articles tagged boost

  1. Boost bind and smart pointers

    I've seen this several times causing troubles:

    1
    2
    
    boost::shared_ptr<Foo> p(new Foo);
    boost::thread t(boost::bind(&Foo::method, p.get()))
    

    This prevents the livecycle management of shared_ptr or any other smart pointer to be effective in the thread. Hence, p may get destructed even though the thread is still active.

    Boost bind can handle smart...

    Read more
  2. Using googlemock with the Boost Test Library

    googlemock is a framework that allows generating mock objects for unit tests. I've decided to use this framework as it looks wells designed and maintained. The default is to use googlemock with Google's unit testing framework googletest, but as I was already using the Boost Testing Library, I was searching for a solution to use googlemock in Boost...

    Read more
  3. Highlights aus der Boost Graph Library

    Template Programming to the Extreme… Manchmal macht es echt eine Freude den Quellcode der BGL (Boost Graph Library) zu lesen. Hier ein paar Highlights:

    1
    2
    3
    4
    5
    6
    
    typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&);
    
    // The graph is passed by *const* reference so that graph adaptors
    // (temporaries) can be passed into this function...
    Read more