boost

Change GCC version used by bjam

I am trying to build a library (luabind) with bjam. I came across an error and it seems like the problem is that I need to compile with gcc 4.2, but the default on this computer (Mac OSX) is 4.0. I would prefer not to go around changing links in system directories, is there a way to specify to bjam to use gcc4.2 rather than just gcc? ...

iterating through TWO sparse matrices

I'm using boost sparse matrices holding bool's and trying to write a comparison function for storing them in a map. It is a very simple comparison function. Basically, the idea is to look at the matrix as a binary number (after being flattened into a vector) and sorting based on the value of that number. This can be accomplished in this ...

what's the correct way of writing this code?

typedef boost::shared_ptr<config_value_c> config_value_ptr; typedef std::vector<config_value_ptr> config_value_vec; config_value_vec config; typeof (config.iterator ()) it = config.iterator (); I want to extract an iterator to an array of boost pointers to class config_value_c. I know I can specify the iterator as std::vector<config...

How to serialize derived template classes with Boost.serialize?

Hello! I'd like to serialize/unserialize following classes: class Feature{ ... virtual string str()=0; }; template<typename T> class GenericFeature : public Feature{ T value; ... virtual string str(); }; I read boost.serialize docs and the sayed that you must register classes. I can register them in constructor. But there will be p...

Boost linking, Visual Studio & version control

I'm using Visual Studio 2008, and writing some stuff in C++. I'm using a Boost library (that is not header only). So, linking to Boost requires one to add the directory to Boost binaries to the project's "additional linker paths" setting. However, doesn't this conflict with source control? If I check in the project files, wouldn't the ...

Using boost::bind with a constructor

I'm trying to create new objects and add them to a list of objects using boost::bind. For example. struct Stuff {int some_member;}; struct Object{ Object(int n); }; .... list<Stuff> a; list<Object> objs; .... transform(a.begin(),a.end(),back_inserter(objs), boost::bind(Object, boost::bind(&Stuff::some_member,_1) ) ); ...

boost::bind, boost::asio, boost::thread, and classes

sau_timer::sau_timer(int secs, timerparam f) : strnd(io), t(io, boost::posix_time::seconds(secs)) { assert(secs > 0); this->f = f; //t.async_wait(boost::bind(&sau_timer::exec, this, _1)); t.async_wait(strnd.wrap(boost::bind(&sau_timer::exec, this))); boost::thread thrd(&io,this); io.run(); //thrd(&sau_ti...

ASIO iostream flush not working?

any ideas why stream.flush(); won't work? boost::asio::ip::tcp::iostream stream("localhost","5000"); assert(stream.good()); stream << 1; stream.flush(); while(true); it's only flushed if the loop is removed and the line boost::this_thread::sleep(boost::posix_time::seconds(1)); is executed (much later). Thanks Update: I did some ...

Boost Threads and Timers, C++

I have this code for a custom class 'sau_timer': sau_timer::sau_timer(int secs, timerparam f, vector<string> params) : strnd(io), t(io, boost::posix_time::seconds(secs)) { assert(secs > 0); this->f = f; this->params = params; t.async_wait(strnd.wrap(boost::bind(&sau_timer::exec, this, _1))); boost::thread thrd(b...

boost microsec_time_clock.hpp warning C4244

Hi. I'm new in using boost and have a problem. I need shared_mutex function in my project. So I've done #include "boost/thread/shared_mutex.hpp" And compiled my project. My MSVC 2005 with "treat warnings as errors" stops compilation because of a warning: c:\\...\microsec_time_clock.hpp(103) : warning C4244: 'argument' : conversion f...

Easiest implement pattern 1 writer - multiple readers with boost library

Hi! I develop a module with multiple threads and one Cache in std::map. Some times I need to update cache. In that time all readers must wait, while I do update map. How can I do this synchronization with boost library? P.S.: some time ago in Boost was read_write_mutex. But in current releases of Boost it missed. ...

seg faults due to multithreading (using boost libraries)

We have a program that uses both boost's matrix and and sparse matrix libraries and we are attempting to integrate boost threads. However, when we move from a single-threaded to multi-threaded application we are getting segmentation faults that do not occur in the single-thread case. We've debugged using gdb (in Eclipse) and I've found...

What's the difference between C++0x concepts and The Boost Concept Check Library (BCCL)?

Concepts didn't make the C++0x standard, but Boost still provides The Boost Concept Check Library (BCCL). I guess that BCCL doesn't cover everything that was meant to into the C++0x standard. What is the difference between BCCL and the proposed C++0x solution? ...

CEvent-like behaviour with Boost.Thread

Problem in words: For my application, I have a class that reads from a serial port. It uses Windows primitives for COM port handling and had a thread for asynchronous reading. I'm trying to convert this away from Windows primitives using Boost libraries such as Boost.Asio and Boost.Thread. In the Windows port, my IO thread had severa...

python object to native c++ pointer

Im toying around with the idea to use python as an embedded scripting language for a project im working on and have got most things working. However i cant seem to be able to convert a python extended object back into a native c++ pointer. So this is my class: class CGEGameModeBase { public: virtual void FunctionCall()=0; virtu...

C++ Question about Boost UBLAS

Does the Boost UBLAS library have a built-in solver for solving systems of equations? The documentation implies that all the ublas solver routines require the matrix to already be in triangular form. But, if a matrix is not in triangular form, is there anything in ublas that can reduce the matrix and then back-substitute, to solve a ...

Boost Priority pool sample?

Hi, I am working on a Boost thread pool. I have a structure like this: class SimThreadPool { static SimThreadPool* getInstance(); boost::threadpool::prio_pool& getThreadPool() { return mThreadPool; } simTerrain::SimThreadPool::SimThreadPool() : mThreadPool(boost::threadpool::fifo_pool(1)) { } boost::thre...

How do I force a 32 bit build of boost with gcc?

How do I force a 32 bit build of boost with gcc? Currently attempting by putting this line in my user-config.jam, but it does not work. using gcc : 4.1.2 : g++ : compileflags="-m32" ; Chenz ...

Downcasting shared_ptr<Base> to shared_ptr<Derived>?

Update: the shared_ptr in this example is like the one in Boost, but it doesn't support shared_polymorphic_downcast (or dynamic_pointer_cast or static_pointer_cast for that matter)! I'm trying to initialize a shared pointer to a derived class without losing the reference count: struct Base { }; struct Derived : public Base { }; shared_...

Regex Syntax - Help

Hi, I need to process a HTML content and replace the IMG SRC value with the actual data. For this I have choose Regular Expressions. In my first attempt I need to find the IMG tags. For this I am using the following expression: <img.*src.*=\s*".*" Then within the IMG tag I am looking for SRC="..." and replace it with the new SRC val...