boost

How to manage object life time using Boost library smart pointers?

Hi, There is a scenario that i need to solve with shared_ptr and weak_ptr smart pointers. Two threads, thread 1 & 2, are using a shared object called A. Each of the threads have a reference to that object. thread 1 decides to delete object A but at the same time thread 2 might be using it. If i used shared_ptr to hold object A's refere...

Using flyweight pattern to share bitmaps between bitmap objects

Hello stack overflowers, I have a desing that uses the flyweight pattern to share bitmaps that are shared between bitmap objects which manage drawing ops, etc. and integrate in the gui library. This is an embedded device so memory is at a premium. Currently I have done a working implementation with a std::vector of auto_ptr of a light cl...

Boost Graph as basis for a simple DAG Graph?

I'm looking at using Boost Graph Library as the basis for a dag graph. I haven't really used it all that much before, so not too familiar with how it works. Although I don't need edge weights and clever traversing algorithms, I would quite like to get the serialisation for free, plus the constraints enforcing dag graphs and disallowing ...

Use a Graph Library/Node Network Library or Write My Own?

I'm trying to decide between going with a pre-made graph/node network library or to roll my own. I'm implementing some graph search algorithms which might require some significant customization to the class structure of the node and/or edges. The reason I'm not sure what to do is that I'm unsure if customization of a pre-made might be...

Boost equivalent of ManualResetEvent?

Hello, I'm wondering if there is a boost equivalent of ManualResetEvent? Basically, I'd like a cross-platform implementation... Or, could someone help me mimic ManualResetEvent's functionality using Boost::thread? Thanks guys ...

How can I use just one boost library/file?

Possible Duplicate: Building a subset of boost in windows I'm using Visual c++ 6.0, and I'd like to use boost::random. I can't find any examples showing how I would go about just using this and only this library. Can I just include it in my source? ...

Binding operator new?

I'd like to bind operator new (see example below). If the constructor doesn't have any arguments, it works fine, but if it does have arguments, I apparently have trouble getting the bind syntax correct. #include <map> #include <boost\function.hpp> #include <boost\lambda\lambda.hpp> #include <boost\lambda\construct.hpp> #include <boost\...

How to resolve host (only) using Boost.Asio?

According to the documentation of boost::asio::ip::tcp::resolver::query in order to resolve host it should receive service as well. What if I want to resolve host without relation to port? How should I do it at all? Should I specify dummy port? ...

QT Eclipse Integration - Adding External Libs

Hi, I have set up the latest eclipse+cdt + mingw + qt + qt-eclipse-integration. I have 2 Problems: When i create "New -> Qt Gui Project" it doesn't add the mingw includes (when i click new c++ project it adds them) I would like to use boost, too. How do I tell eclipse/qmake to add the .lib's ? Thank you Chris ...

Boost equivalent of memcpy?

Hey all, Is there a boost equivalent for memcpy? Thanks! EDIT: Sorry, I didn't realize memcpy was in the standard library :) I thought it was an OS call :( ...

How to release pointer from boost::shared_ptr ?

Can boost::shared_ptr release the stored pointer without deleting it? I can see no release function exists in the documentation, also in the FAQ is explained why it does not provide release function, something like that the release can not be done on pointers that are not unique. My pointers are unique. How can I release my pointers ? O...

Wildcard search inside a Boost.MultiIndex data structure?

I'm trying to optimize my application by reducing round-trips to my database. As part of that effort, I've been moving some of the tables into memory, storing them as Boost.MultiIndex containers. As a side-effect of this process, I've lost the ability to do wild-card matching on my strings. For example, when the table was stored in My...

Get path of executable

I know this question has been asked before but I still haven't seen a satisfactory answer, or a definitive "no, this cannot be done", so I'll ask again! All I want to do is get the path to the currently running executable, either as an absolute path or relative to where the executable is invoked from, in a platform-independent fashion. ...

Using Boost Graph to search through a DAG Graph?

I need to search through a DAG graph, but I don't want to advance past a node before I have seen all of the other nodes that have directed links pointing to it. Is there an existing algorithm to handle this particular situation, the depth first search and breath first search don't work for this order of traversal. Ie: A -> B B -> C C ...

C++, boost asio, receive null terminated string

Hi, How can I retrieve null-terminated string from socket using boost::asio library? Thanks in advance ...

How do I make Boost build for i386 on OS X 10.6?

I've been battling with Boost to make it compile as only 32 bit on 10.6, rather than 64 bit. Is there an easy edit I can make to the darwin-specific bjam config file? Thanks, Jon ...

Memory leak caused by a wrong usage of scoped_lock ?

I have a memory leak, and I guess it's caused by a wrong usage of scoped_lock (Boost). I however don't manage to find the exact problem, and I do believe that the way the code has been written is not completely right neither. The code is in this class there: http://taf.codeplex.com/SourceControl/changeset/view/31767#511225 The main imp...

How to get rid of C4800 warning produced by boost::flyweight in VS2008

Hi, I get a warning when compiling below code in VS2008 with MFC turned on. Boost version 1.39 include "boost/flyweight.hpp" include "boost/flyweight/key_value.hpp" class Foo { public: Foo(const CString} private: const CString mfoo; }; struct Conversion { const CString} }; using namespace boost::flyweights; flyweight<...

Boost.Regex oddity

Hi, Does anyone have any idea why the following code would output "no match"? boost::regex r(".*\\."); std::string s("app.test"); if (boost::regex_match(s, r)) std::cout << "match" << std::endl; else std::cout << "no match" << std::endl; ...

Excluding boost signal calling

There is a signal and several objects with slots. I want to implement the behavior when one object calls signal and blocks its own connection. I guess a small snippet will be more informative: typedef boost::signal<void()> TSignal; template<class TSignal> class SlotObject { public: void Connect(boost::shared_ptr<TSignal> pSignal...