boost

Problem compiling boost.asio example on AIX with IBM Visual Age C++ 7.0

This is definitely going to be one of my more arcane questions, but I hope someone has had to deal with this pain. I am porting some software to IBM AIX 5.3, using IBM VisualAge C++ 7.0 compiler. The source code depends on boost.asio for networking, and when I was building the code, I got an error from the source: include/boost/asio...

Unordered (hash) map from bitset to bitset on boost

Hello, I want to use a cache, implemented by boost's unordered_map, from a dynamic_bitset to a dynamic_bitset. The problem, of course, is that there is no default hash function from the bitset. It doesn't seem to be like a conceptual problem, but I don't know how to work out the technicalities. How should I do that? Thanks. ...

Boost Condition Variable Argument Error

Hello to all, i encounter an error in the code below. recursive_mutex m_RecurMutex; condition_variable cond; unique_lock<recursive_mutex> lock(m_RecurMutex); cond.wait(lock); // Error Here. What is the reason cause this error ? Thanks. ...

How to link C++ program with Boost using CMake

What should my cmake file should look like for linking my program with boost library under Ubuntu? The errors show during running make: main.cpp:(.text+0x3b): undefined reference to `boost::program_options::options_description::m_default_line_length' The main file is really simple: #include <boost/program_options/options_description...

boost::filesystem::path and std::string

Hi, I have a String class which has a member std::string. One of the constructor is String (std::string s) { // member: std::string _mString; _mString = s; // error on path assignment } I now have functions that take String as parameter, e.g. Load(String path); but it turns out that boost::filesystem::path::string() is inc...

How to fold STL container

Hi! I need analog of Haskell's foldl function to fold any STL containers. Expected signature is like following: template Iterator, FoldingFunction, Result Result foldl( Iterator begin, Iterator end, FoldingFunction f, Result initValue); Standard STL has no such function. Does Boost have any? I know it's pretty simple to im...

Using exceptions within a boost::thread thread

Hello, I began to play around with boost::threads, but I'm kind of stuck with this problem: I don't understand why this program crashes as soon as the exception is thrown, because I try to catch it within the thread. I thought that it would be possible to work with exceptions as long as the handling happens in the same thread as the t...

Getting offset_ptr of object in shared memory

How can i access the offset_ptr of the object which is created in the shared memory? segment = new managed_shared_memory(create_only, "MySharedMemory", segmentSize); line = segment->construct<Line>("Line1")("line"); I want to access of offset_ptr for Line object.. ...

Boost::Scoped_Ptr breaks code

Examine the following code: This works: T *p = (std::find( this->first(), this->last(), *pPos )); if( p != last() ) { this->push_back(data); T *right = (this->last() - 1); T *left = (this->last() - 2); while( *pPos != data ) std::iter_swap( left--, right-- ); return const_cast<T*>(pPos); } This does n...

Is this a good concept for sending serialized objects over Network?

I have a client and a server I want to send objects from client to server The objects must be send bundled together in a "big packet" containing many objects The objects could be in a random order The number of objects is not fixed There could be objects in the packet which are unknown to the server (so he needs to dump them) I haven'...

linear_congruential library in boost

I am trying to use random::linear_congruential in boost (http://www.boost.org/doc/libs/1_33_1/libs/random/random-generators.html#linear_congruential) to generate uniform random numbers. The declaration is defined as: template<class IntType, IntType a, IntType c, IntType m, IntType val> Does anyone know what the last parameter IntType ...

Creating own implementation of Boost::Archive

I'm currently creating a concept which uses Boost::Serialization and which needs to implement its own Boost::Archive cause the data has to be serialized in a certain way. There is documentation about implementing custom archives in the documentation: http://www.boost.org/doc/libs/1_44_0/libs/serialization/doc/index.html But I'm curious...

How do I compile a simple c++ program that uses boost::thread in cygwin?

I installed boost on cygwin, and tried to compile the following program: #include <iostream> #include <boost/thread/thread.hpp> using namespace std; void hello() { cout << "Hello cworld" << endl; } int main() { boost::thread t(hello); t.join(); } via $ g++ test.cpp -lboost_thread /usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../../...

Boost.Asio: Operation Cancelled on async_read

Another one in the continuing saga of myself vs. Boost.Asio... I have a simple asynchronous client and server that utilise async_write and async_read to communicate. The client can successfully write bytes to the socket, but the server never sees them; my read handler on the server fails with "Operation cancelled". I'm inclined to beli...

Searching std::unordered_set by hash value and predicate

How can I search a std::unordered_set knowing hash value and having some predicate object? (The predicate determining equivalence by pred(x) && pred(y) meaning x == y.) ...

Boost Fusion container of shared pointers (shared_ptr) causing Segmentation Fault (sigsegv) or garbage results

Edit: This issue only seems to happen with the combination of joint_view and shared_ptr. Raw pointers seem to work fine in the same scenario, as do shared pointers in a plain fusion container constructed w/ all its items at once, without adding anything more to it. Details below: I'm using mingw gcc 4.5.1 Running into a peculiar issue...

How do compile a simple program using boost::thread in cygwin?

I installed the boost package from cygwin and have a directory /usr/include/boost that includes a bunch of *.hpp files, including thread.hpp, which I need to include in the c++ file, via #include <boost/thread.hpp> Also, several *.a files seem to be related to boost::thread. $ ls /usr/lib/libboost_thread* -1 /usr/lib/libboost_thread-...

MSVS2010 linker error sadness - not entirely sure what is wrong

I am using a library of code from a tutorial for providing functionality for passing function points of non-static member functions to a function that expects a static function pointer, probably helps to know what I am suing, so here is the link http://www.codeproject.com/KB/cpp/thunk32.aspx This code uses the Boost library, which I have...

How can I achieve something similar to a semaphore using boost in c++?

I noticed that boost does not seem to support semaphores. What's the easiest way to achieve a similar effect? ...

Boost condition deadlock using wait() in producer-consumer code

I have implemented a basic threaded producer-consumer (thread 1 = producer, thread 2 = consumer) using Boost threads and conditions. I am getting stuck in wait() indefinitely quite often. I can't really see what could be wrong here. Below is some pseudo-code: // main class class Main { public: void AddToQueue(...someData...) { b...