boost

Boost xpressive error

This simple example using Boost xpressive (latest version) throws 'Access violation reading location 0x000000'. The error occurs on regex_match. This has to be something simple but I've looked it until I am crazy. Why does this not work? Is my regex wrong? Am I using xpressive wrong? Please help and thanks! using namespace boost::xpre...

c++ boost asio timeout for blocking connect

I have a C++ boost client that does a blocking connect and processes the message once it receives a response. I am facing a strange issue. tcp::resolver::query query(tcp::v6(), this->host, port,tcp::resolver::query::v4_mapped); iterator = resolver.resolve(query); socket = new tcp::socket(io_service); socket->connect(*iterator); I tri...

boost lambda question

#include <iostream> #include <set> #include <algorithm> #include <boost/lambda/lambda.hpp> #include <boost/bind.hpp> using namespace std; using namespace boost::lambda; class Foo { public: Foo(int i, const string &s) : m_i(i) , m_s(s) {} int get_i() const { return m_i; } const string &get_s() const { return m_s; } fri...

Linking a static library into Boost Python (shared library) - Import Error

I am building a Boost Python module (.so shared library file) which depends on another external library (STXXL) While I can build and import the example Boost Python modules, I run into problems when STXXL is thrown into the mix. Specifically when running import fast_parts in python I get ImportError: ./fast_parts.so: undefined symbol...

What are use cases for booster::noncopyable?

First: is it boost::noncopyable or booster::noncopyable. I have seen both in different places. Why would one want to make a class noncopyable? Can you give some sample use cases? ...

Is there a muti index container for the harddisk storage rather than memory?

I need a muti index container based on red-black trees (something like boost::multi_index::multi_index_container) for the case of the harddisk storage. All data must be store on hard disk rather than in memory. Is there an open source container such that described conditions hold? Note. I use C++. ...

Build Boost for Windows CE 5.0

Does anyone have a set of instructions for building boost libraries for use on Windows CE? I've found some discussions on it: boost build mailing list and another one from the boost build mailing list ... but surely someone has written up something more concrete... ...

Cannot use BOOST_CHECK under Visual Studio 2010

Hi everyone, Whenever I tried to run a simple main() with BOOST_CHECK( 1 == 2 ); The compiler broke at runtime, and it linked me to malloc(...) call which I think it relates to memory issue? How could this be possible since I have nothing call new or delete? Any idea? Thanks, ...

Can I build boost for mingw and windows from same folder?

So I have a folder with boost 1.44.0 and I need both msvc and MinGW binary libraries. I have already done the msvc build and need to do the MinGW gcc build next. Can I build from the same folder? My reasoning is this should not create a problem as the .a/.so libraries are just placed in the same lib folder but the headers/sources and not...

boost::asio async_accept Refuse a connection

Hello, My application have an asio server socket that must accept connections from a defined List of IPs. This filter must be done by the application, (not by the system), because it can change at any time (i must be able to update this list at any time) The client must receive an acces_denied error. I suppose when the handle_accept ...

First Boost program

I have tried to write my first Boost program from information on the Boost libraries site. Here is the code: #include <boost/lambda/lambda.hpp> #include <iostream> #include <iterator> #include <algorithm> int main() { using namespace boost::lambda; typedef std::istream_iterator<int> in; std::for_each( in(std::cin)...

c++ is_str_empty predicate

std::vector<std::wstring> lines; typedef std::vector<std::wstring>::iterator iterator_t; iterator_t eventLine = std::find_if(lines.begin(), lines.end(), !is_str_empty()); how do I define is_str_empty? i don't believe boost supplies it. ...

Calculate mean and moment in Boost library

I am trying to implement a program which calculates the mean and moment by using the Boost library's accumulator. Here is the code: #include <iostream> #include <boost/accumulators/accumulators.hpp> #include <boost/accumulators/statistics/mean.hpp> #include <boost/accumulators/statistics/moment.hpp> using namespace boost::accumulators...

Boost Spirit auto-rule problem

I'm using attribute propagation to construct a syntax tree for a toy language. I've hit a problem at the definition of my if statement, it's hard to tell from the error message but I think the rhs attribute isn't collapsing into the expected attribute. It should collapse to a tuple <double,Statement,optional<Statement>> I think. The err...

boost deadline_timer question

I expected the code below to print Hello, world! every 5 seconds, but what happens is that the program pauses for 5 seconds and then prints the message over and over with no subsequent pauses. What am I missing? #include <iostream> #include <boost/asio.hpp> #include <boost/date_time/posix_time/posix_time.hpp> using namespace boost::as...

Can I Use Boost Message Queues for Thread Communication

Hi, I am spawning multiple worker threads from a main thread. Can I create message_queue for each thread from the main thread and send messages from the main thread. Am I asking this because message queues are meant for interprocess communication. Do I need to consider anything specific regarding this ...

How to initialize a shared_ptr that is a member of a class?

Hi, I am not sure about a good way to initialize a shared_ptr that is a member of a class. Can you tell me, whether the way that I choose in C::foo() is fine, or is there a better solution? class A { public: A(); }; class B { public: B(A* pa); }; class C { boost::shared_ptr<A> mA; boost::shared_ptr<B> mB; void...

How to suspend variable assignment with boost::bind or boost::lambda?

I want to suspend a void() function that sets a stack variable to true. How can I do this? bool flag = false; boost::function<void()> f = ...; f(); assert(flag); This is, obviously, toy code that demonstrates the problem. My attempt at this, using bind, was bind<void>(_1 = constant(true), flag);, but this yields a compilation error. ...

Boost 1_44 includes don't work

Sorry for what seems like a silly question: But I've never, ever worked with boost, until tonight, and I'm finding that getting it configured seems to be harder to use than it should be. I wanted experiment with it tonight. So I downloaded the zip file, and unzipped it to a directory here: F:/boost_1_44_0 Then I created an empty c++ p...

what is the execution order of a threaded and non-threaded function call?

hello, i have written a simple console application just to try boost::thread, i am a multithreading newbie by the way. here is the code #include <iostream> #include <boost/thread/thread.hpp> #include <windows.h> using namespace std; void Avg(double * Src, double *Dst, int Per, int Len, string& s ) { LARGE_INTEGER s1,s2,f; Que...