boost

boost::array not compiling on VS 2005

Sorry this is probably a stupid question, as I couldn't find anything at all on google on the subject. Anyways I'm trying to compile some source code, that uses boost::array with visual studio 2005, as a Win32 console application (not clr), however for some reason that escapes me Visual Studio still considers the word array a keyword, so...

Compile error using boost::concept_check

Hi, I'm trying to compile simple example to use the boost concept_check Code is as follow: #include <vector> #include <complex> #include <algorithm> #include <boost/iterator.hpp> #include <boost/concept_check.hpp> template <class foo> void my_do_sort(std::vector<foo>& v) { BOOST_CONCEPT_ASSERT((RandomAccessIterator<foo>)); std:...

Boost best practices?

I've used Boost graph library a fair amount but not much of the rest of it. I frequently see recommendations here to use parts of Boost (say, Boost's various smart pointers). Obviously Boost is good and good to use. It is also large or diverse. Does anyone know of a FAQ or decent best practices doc to help a knowledgeable C++ programmer ...

How to retrieve an object instance related to a Thread in C++?

Hello, In java I have the following generated code: public class B { public void exec(){ X x = (X) Thread.currentThread(); System.out.println(x.value); } } public class X extends Thread{ public int value; public X(int x){ value = x; } public void run(){ B b = new B(); b.exec(); } ...

C++ Boost: what's the cause of this warning?

I have a simple C++ with Boost like this: #include <boost/algorithm/string.hpp> int main() { std::string latlonStr = "hello,ergr()()rg(rg)"; boost::find_format_all(latlonStr,boost::token_finder(boost::is_any_of("(,)")),boost::const_formatter(" ")); This works fine; it replaces every occurrence of ( ) , with a " " However, I get ...

Including boost libraries in make files.

I'm learning Boost and am having trouble with my makes files. Here is my basic makefile: accesstimer: acctime.o btimer.o g++ acctime.o btimer.o -o accesstimer acctime.o: acctime.cpp btimer.h g++ -c acctime.cpp bentimer.o: btimer.cpp btimer.h g++ -c btimer.cpp When acctime.cpp has no boost filesystem elements in it this...

boost signal double free?

I'm having a hell of a time trying to debug some kind of memory access error, which I believe is a double free. The code is too complex to post, but I can try to describe it. Basically, I have two threads. When the worker thread is created, it instantiates a new boost::signal object, and stores it in a shared_ptr. The parent then querie...

cannot link boost.system in makefile

Just asked a question about linking Boost libraries in the make file. Thanks to those who helped with that. I ended up with this: accesstimer: acctime.o bentimer.o g++ -L/usr/local/boost/boost_1_39_0/stage/lib -lboost_system -lboost_filesystem acctime.o bentimer.o -o accesstimer acctime.o: acctime.cpp bentimer.h g++ -I /us...

BUG on boost spirit?

I'm trying to migrate my code from VSC++ 6 to VSC++ 2008 express edition and from Intel compiler to Microsoft compiler. Everything were easy to migrate except that I'm receiving this errors now: 1>------ Build started: Project: Base, Configuration: Debug Win32 ------ 1>Compiling... 1>DefaultScriptReader.cpp 1>Warning: This header is dep...

boost:thread crashes microsoft C++ compiler

Brief version of my question: This code crashes the compiler. pThread[0] = new boost::thread( boost::bind( &cGridAnimator::DoJob, // member function this ), // instance of class 0 ); // job number The compiler crashes when attempting to compile this code. ( It is not my program that...

how do I get the non-flag and non-option tokens after boost::program_options parses my command line args

In python, I can construct my optparse instance such that it will automatically filter out the options and non-option/flags into two different buckets: (options, args) = parser.parse_args() With boost::program_options, how do I retrieve a list of tokens which are the remaining non-option and non-flag tokens? e.g. If my program has fl...

accessing element of boost sparse_matrix seems to stall program

I've got a strange bug that I'm hoping a more experience programmer might have some insight into. I'm using the boost ublas sparse matrices, specifically mapped_matrix, and there is an intermittent bug that occurs eventually, but not in the initial phases of the program. This is a large program, so I cannot post all the code but the core...

Updating Boost Wave from SVN

Hi, I have run into some bugs into one of the boost components that I am using. After analyzing the problem a bit, I've found that I was not the only one, and the author had already issued a fix that is available in the boost SVN trunk. What would be the best approach if I wanted to update just this component and reuse the libraries th...

Creating a boost's managed_mapped_file

Hello, I would like to create a managed_mapped_file which should contain a certain number of elements[n] of a certain size [k], therefore the required size which I would like to use is n*k (size of element * number of elements). But when the file is created [*new bip::managed_mapped_file (bip::create_only, fileName, n*k);*] besides the ...

boost asio taking 100% cpu on read

Hi, i made a socket app that uses boost asio how ever it seems to take a lot of cpu when i try to read any thing from the socket. Atm i use a wrapper class so i dont have to expose the boost header files in my header file that looks something like this: class SocketHandle { public: SocketHandle() { m_pSocket = NULL; ...

Boost::tuple's equivalent to Python's itemgetter?

I have some code that looks like this: typedef tuple<int, int, double> DataPoint; vector<DataPoint> data; vector<double> third_column_only; // Code to read in data goes here. transform(data.begin(), data.end(), back_inserter(values), tuples::get<1, DataPoint>); Unfortunately, the last line doesn't compile - it gives me a message like ...

How do I create synchronization mechanisms in managed shared memory segments?

I'm trying to have 2 processes communicate via an stl container - so I've decided to use the managed shared memory. I'm trying to implement some synchronisation between them - an interprocess_mutex for a start with a scoped_lock - but I'm not having much luck. How is it supposed to be done? ...

The Boost Statechart Library - how to implement time-consuming transitions

In our project we have UI and logic (which may be represented as a state machine). Transitions between some steps in this step machine are long (IO-bound). We don't want to steal our UI thread for all the time the transition is in progress. Therefore we are looking for a way to perform this transitions in a separate thread and then updat...

Using stl containers without boost pointers

My company are currently not won over by the Boost libraries and while I've used them and have been getting them pushed through for some work, some projects due to their nature will not be allowed to use Boost. Basically libraries, like Boost, cannot be brought in for work so I am limited to the libraries available by default (Currently ...

Boost Multi-Index Custom Composite Key Comparer

I'm looking to write a custom comparer for a boost ordered_non_unique index with a composite key. I'm not exactly sure how to do this. Boost has a composite_key_comparer, but that won't work for me, because one of the comparers for a member of the key depends on a previous member. This is a simplified example, but I want the index to ...