boost

pushing back an boost::ptr_vector<...>::iterator in another boost::ptr_vector?

Hi all, I have the following code (just typed it in here, might have typos or stuff): typedef boost::ptr_vector<SomeClass> tvec; tvec v; // ... fill v ... tvec vsnap; for(tvec::iterator it = v.begin(); it != v.end(); ++it) { if((*v).anyCondition) vsnap.push_back( it ); // (*it) or &(*it) doesn't work } My problem is now ...

Boost 1.4.0, "assert" identifier not found

I'm trying to compile an old project that was originally written for linux on windows. It uses boost 1.4.0, and whenever I compile it throws error C3961: "assert" : identifier not found. I'm using Visual Studio 208 SP1 When I drill down into assert.hpp it includes this: # include <assert.h> // .h to support old libraries w/o <cassert> ...

Boost Jam vs Jam

I recently built the Boost libraries in Linux and noticed the package needed an executable called bjam in order to do the build. Is bjam related to jam? If it is related to jam, did they somehow extend (or even dumb-down) bjam? Is it used only for building Boost libraries or is it a general build tool for anything? ...

Do newer versions of BJam support backwards compatibility with older versions of Boost?

I'm trying to build version 1.35 of Boost with the newest version of bjam that is bundled with version 1.42 Boost. Will this adversely affect the results of the build? Is this even possible? The reason I'm trying to do this is because the newest version of BJam has support for command line options that are not included in the older ver...

Extracting pair member in lambda expressions and template typedef idiom

Hi, I have some complex types here so I decided to use nifty trick to have typedef on templated types. Then I have a class some_container that has a container as a member. Container is a vector of pairs composed of element and vector. I want to write std::find_if algorithm with lambda expression to find element that have certain value. T...

missing ';' before namespace when using boost 1.4.2

Working on moving some C++ code from Linux over to Windows. The code uses boost 1.4.2, however it keeps failing out on building the boost modules. Basically, every boost hpp file that happens to contain "namespace boost" errors with: error C2143: syntax error : missing ';' before 'namespace' Any idea what could be causing this? ...

Generating classes based on boost state machines

Hello, I am developing a network based server which can potentially have 100s of states and actions/events. So far I have managed with simple switch statements but now feel a need for a state machine which I can configure externally by text/xml file. What is your suggestion for existing C++ state machine which allows me to configure ...

How does one create a shared_ptr to pass to a function that takes a void *

That's pretty much it. I need to allocate memory and pass it to a function that takes a void *. I'd like to use a shared_ptr but I don't know how to do it. ...

How to create a array of boost matrices?

How can I define a array of boost matrices as a member variable? None of the following worked. boost::numeric::ublas::matrix<double> arrayM(1, 3)[arraySize]; boost::numeric::ublas::matrix<double>(1, 3) arrayM[arraySize]; boost::numeric::ublas::matrix<double> arrayM[arraySize](1, 3); Thanks, Ravi. ...

[C++/Boost] "Unhandled exception" error when using a loop inside thread

Hello there, I got this error Unhandled exception at 0x0049b946 in Program.exe: 0xC0000005: Access violation reading location 0x00000090. and the error points to this line: // thread.hpp ln 56 void run() { f(); // here << } When trying to run this code: void frameFunc() { for(;;) ...

how to compile boost thread library

Hi, I want to compile only the thread and regular expresession library of boost and I want both static and dynamic libs. Could you please let us know how to do that? Thanks. ...

How to handle 'this' pointer in constructor?

I have objects which create other child objects within their constructors, passing 'this' so the child can save a pointer back to its parent. I use boost::shared_ptr extensively in my programming as a safer alternative to std::auto_ptr or raw pointers. So the child would have code such as shared_ptr<Parent>, and boost provides the shar...

How to include only BOOST smart pointer codes into a project?

What are best practices to include boost smart pointer library only without adding all boost libraries into the project? I only want boost smart pointer library in my project and I don't want to check in/commit 200 MB source codes (boost 1.42.0) into my project repository just for that. What more, my windows mobile project itself doesn'...

How can I do an overlapping scatter using Boost.MPI?

I want to distribute a vector with overlapping elements. For example, if I had [1,2,3], I'd want [1,2] to get sent to one node, and [2,3] to get sent to another. I'm familiar with how to do this using MPI, but how would I do this using Boost::MPI? ...

Using time facets on universal_time

Hi all, on boost, to create a time facet to format an specified time we use the folowing: boost::local_time::local_time_facet* facet = new boost::local_time::local_time_facet("%Y%m%d %H:%M:%S.%f"); std::stringstream date_stream; date_stream.imbue(std::locale(date_stream.getloc(), facet)); date_stream << boost::local_time::local_microse...

How to setup directories in Visual Studio when using boost?

Hi, I have introduced boost to our code base, on my machine I created a boost directory called Thirdparty.Boost and added that as an additional include directory in my Visual Studio setting, all is fine. However I now want to check in my changes, so the rest of the team can get them. Inorder to build the code they would need to setup b...

Multithreading: apache portable runtime vs boost::thread?

Which way is better for a novice student who has never used boost? When a new standard arrives, the answer will be obvious, but now I have doubts. Pro for boost is that it's much closer to future standard. ...

Linking Boost to my C++ project in Eclipse

I'm trying to get the Boost library working in my C++ projects in Eclipse. I can successfully build when using header-only libraries in Boost such as the example simple program in the "Getting Started" guide using the lambda header. I cannot get my project to successfully link to the regex Boost library as shown later in the guide. Unde...

How to link to dynamic boost libs?

I compiled boost lib and got these. //Shared/dynamic link libraries 24/03/2010 11:25 PM 53,248 boost_thread-vc80-mt-1_42.dll 24/03/2010 11:25 PM 17,054 boost_thread-vc80-mt-1_42.lib 24/03/2010 11:25 PM 17,054 boost_thread-vc80-mt.lib 24/03/2010 11:25 PM 73,728 boost_thread-vc80-mt-gd-1_...

boost smart pointers and BOOST_NO_MEMBER_TEMPLATES

After some struggling I managed to get boost smart pointers to build for Windows CE/Mobile at warning level 4. I found the least-resistance-way to get rid of compile errors and warnings to be #define BOOST_NO_MEMBER_TEMPLATES What does it actually mean? Did I sell my soul to the devil? Will all hell break loose when I actually use th...