boost

Boost (v1.33.1) Thread Interruption

How can I interrupt a sleeping/blocked boost::thread? I am using Boost v1.33.1, upgrading is not an option. Thank you. ...

C++ Boost date with format dd/mm/yyyy?

How could I print the current date, using Boost libraries, in the format dd/mm/yyyy H? What I have: boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); cout << boost::posix_time::to_simple_string(now).c_str(); 2009-Dec-14 23:31:40 But I want: 14-Dec-2009 23:31:40 ...

boost::mutex / How to test if a mutex is locked

I know, I know, the title of my message may seem provocative, since boost::mutex purposefuly do not expose lock / unlock (in order to avoid dead locks). However the boost documentation is quite short on these aspects (to say the least), so I am asking if anyone can help me in the following use case. Suppose you have a class Foo, which...

Unit testing an executable project

Maybe I am not thinking about this correctly. I am starting my second project using unit tests. My first project I rolled my own, for this project I am trying out Boost::test. My question is, what are the proper procedures for unit testing projects that compile into executables? It seems like everything I see out there is for librarie...

boosts buffer into char* (no std::string)

So, it may be sounds as a realy newbies question... And proboly it is newbies :) I try to turn infomation from boost::asio::streambuf which I got, using read_until into char*. I've found realy many examples of turning it into std::string, but I'd mad, if use bufer -> std::string -> c_str in an application, needs a high perfomanse. (But ...

Is there an equivalent to Boost::Python for Java?

I've been working with Boost::Python to expose some high-performance code to python recently, and it's just a dream to work with. I'd like to be able to maintain a single C++ codebase and expose it to Python via Boost, and to Java as well. I know about JNI, but I was wondering if there's something equivalent to Boost::Python, but targe...

const shared_ptr to shared_ptr

Hello How to convert shared_ptr that points to const object to shared_ptr that point to nonconst object. I am trying to do the following : boost::shared_ptr<const A> Ckk(new A(4)); boost::shared_ptr<A> kk=const_cast< boost::shared_ptr<A> > Ckk; But it doesnot work. ...

boost::bind & boost::function pointers to overloaded or templated member functions

I have a callback mechanism, the classes involved are: class App { void onEvent(const MyEvent& event); void onEvent(const MyOtherEvent& event); Connector connect; } class Connector { template <class T> void Subscribe(boost::function <void (const T&)> callback); } App::App() { connect.Subscribe<MyEvent>(&App::OnEv...

std::istreambuf_iterator restarts connecting 4 times

I've got some kind of debug-prints in boost using application. When something comes to 80th port I see "Somebody's knoking", and few other string showing the process of query analysis. So, on string std::string std_st = std::string(std::istreambuf_iterator<char>(&_inbuffer), std::istreambuf_iterator<cha...

c++ boost regex which element was true

The answer to this may be a simple no, but here goes... I'm currently using the boost function regex_match to evaluate a string against a regex value. Instead of just returning T/F, is there a way to find out which element of multiple joined statements evaluated to true? For example: ^a$|^z$|^p$ a --> 0 z --> 1 f --> -1 ...

Find a cycle in an undirected graph (boost) and return its vertices and edges.

I need a functions thats find a cycle in an undirected graph (boost) and returns its vertices and edges. It needs only return the vertices/edges of one cycle in the graph. My question is - what is the best way to do this using with boost? I am not experienced using it. ...

How to serialize shared/weak pointers?

I have a complex network of objects connected with QSharedPointers and QWeakPointers. Is there a simple way to save/load them with Boost.Serialization? So far I have this: namespace boost { namespace serialization { template<class Archive, class T> void save(Archive& ar, QSharedPointer<T> const& ptr, unsigned version...

shared_ptr, subscription, destructor

I'm using Boost/shared_ptr pointers throughout my application. When the last reference to an object is released, shared_ptr will delete the object for me. The objects in the application subscribes to events in a central location of the application, similar to the observer/subscriber pattern. In the object destructors, the object will un...

Copy constructor not called, but compiler complains that there's no

Hi there! Given the following code: #include <boost/noncopyable.hpp> enum Error { ERR_OK=0 }; struct Filter : private boost::noncopyable { Filter() {} virtual ~Filter() {} virtual int filter(int* data) const = 0; }; struct SpecialFilter : public Filter, private boost::noncopyable { inline SpecialFilter(unsigned int min, u...

Using pattern Adapter for Image Viewer

Hi! I do the Image Viewer. I want to use GDI+ for showing a picture in a window. And the library boost::gil for rotating, converting, resizng an image. But GDI+ contains Image class and boost::gil contains other class Image. How can I use the pattern Adapter for my task? Or what pattern should I use? Thanks! ...

Boost Libraries Support for MS VC++ 10.0

Friends I have been using Microsoft Visual C++ 2010 Express edition and also downloaded the Boost Libraries for Windows and I would want to have Boost linked with VC++ so that I can run programs that involves Boost libraries in VC++. Please provide some inputs on Boost with VC++ Thank you ...

Problem with boost memory mapped files: they go to disk instead of RAM

I am trying to understand how Boost memory mapped files work. The following code works, it does what it is supposed to do, but the problem is that the file it generates is stored on disk (in the same directory of the executable) instead of memory. Maybe there is a flag to set somewhere, but I could not find it... Thanks in advance for an...

Boost Filesystem Compile Error

I'm writing some code that utilizes the boost filesystem library. Here is an excerpt of my code: artist = (this->find_diff(paths_iterator->parent_path(), this->m_input_path) == 1) ? (*(paths_iterator->parent_path().end() - 1)) : (*(paths_iterator->parent_path().end() - 2)); album = (this->find_diff(paths_iterator->parent_path(), this->m...

Boost Test Fixture object clearing between tests.

I am having a issue with boost unit testing. Basically I create a fixture which is part of a suite to unit test a Resource cache. My main issue is between tests the Resource cache is becoming empty. So the first test that tests the cache passes then the second one will fail because the data the first test inserted into the cache is no...

How to use Boost 1.41.0 graph layout algorithmes

Hi I have problem using boost graph layout algorithmes. boost verision 1_41_0 mingw g++ 4.4.0. So there are issues I have encountered Can you suggest me with them? The function fruchterman_reingold_force_directed_layout isn't compiled. The kamada_kawai_spring_layout compiled but program crashed. Boost documentation to layout algorith...