boost

boost random number library, use same random number generator for different variate generators

It seems that one can use the following code to produce random numbers from a particular Normal distribution: float mean = 0, variance = 1; boost::mt19937 randgen(static_cast<unsigned int>(std::time(0))); boost::normal_distribution<float> noise(mean, variance); variate_generator<mt19937, normal_distribution<float> > nD(randgen, noise); ...

Boost Asio async_read doesn't stop reading?

So, I've been playing around with the Boost asio functions and sockets (specifically the async read/write). Now, I thought that boost::asio::async_read only called the handler when a new buffer came in from the network connection... however it doesn't stop reading the same buffer and thus keeps calling the handler. I've been able to m...

Boost deserialization of contained object fails when performed from a constructor, but succeeds otherwise.

Boost deserialization of contained object fails when performed from a constructor, but succeeds otherwise. E.G.: ContainingClass::ContainingClass() { pNA = new objectArray*[NUMBER]; // allocates ptrs // ... pNA[ii] = new objectArray(SIZE);// allocates object array, and object array // has...

How to get boost wdirectory_iterator to return UTF32 on the Mac

directory_iterator returns UTF8 using both Visual Studio and Xcode as expected. wdirectory_iterator, however, returns UTF16 using Visual Studio, and UTF8 using Xcode, despite returning a wchar_t string. What can I change to get wdirectory_iterator to return UTF32? An answer to a question I asked previously suggests that changing the l...

simple install using bjam

I'm a boost.build newby and while bjam is quite easy to use for most compiling tasks and I didn't figured out how to do something that should be really simple : installing my application in the system. Say I have a very simple project with two files in tree (besides Jamroot). hello.cpp : a C++ program say it prints the content of /etc...

C++ Boost: is it included by default in most Linux distros?

Is the C++ Boost library usually included by default on most Linux distros? ...

Boost installation -Simplified Build From Source

As mentioned in the docs what do i need to install to run the commands : bootstrap .\bjam The BoostPro Computing folks maintain the Boost installer for Windows, but if I first run the installer and download a minimal build and then run the installer again, the installer doesn't detect that I've already installed Boost already and I ...

boost lib build configuraton variations

I am new to boost - can you please tell me what are the difference b/w the following variations of the boost lib and which one do I need to link to in which case? libboost_unit_test_framework-vc80-1_35.lib libboost_unit_test_framework-vc80-gd-1_35.lib libboost_unit_test_framework-vc80-mt-1_35.lib libboost_unit_test_framework-vc80-mt-...

What's the best way to optimise the build of a project which uses Boost?

I was a bit staggered today by the sheer number of auto generated includes that Boost produces when doing a compile if we turn on verbose includes. We're averaging 3000 header files included per compilation unit and sometimes getting up to 5000. Virtually all of it is caused by Boost's preprocessor-meta programming funk with large numb...

Joining a boost::thread instance in the destructor

I'm seeing an issue where a call to boost's thread->join in a destructor leads to a deadlock. I don't understand why, and I'm not too keen on keeping code that just works (and I don't understand why it does) in the project. Class declaration (I've stripped the run() method of try/catch for brevity: according to the boost thread documen...

Use Eclipse's code completion for boost

Hi, I would like to profit from Eclipse's code completion for boost:shared_pointer in Eclipse 3.5 with CDT 6.0. Eclipse doesn't offer any completion while I'm writing the following code: #include <boost/shared_ptr.hpp> #include "A.h" typedef boost::shared_ptr<A> aPTR; int main() { aPTR test(new A); test->ge.... // no comp...

Why is this boost::variant example not working?

I am getting to know boost::variant. I think this example should work. #include <boost/fusion/sequence.hpp> #include <boost/fusion/include/sequence.hpp> #include <boost/variant/variant.hpp> #include <string> #include <vector> #include <iostream> #include <boost/variant/get.hpp> boost::variant< bool,long,double,std::string, std::vector<...

Is boost::object_pool synchronized?

Is boost::object_pool synchronized? ...

boost asio: maintaining a list of connected clients

I'm looking for the best way to modify the Boost Asio HTTP Server 3 example to maintain a list of the currently connected clients. If I modify server.hpp from the example as: class server : private boost::noncopyable { public: typedef std::vector< connection_ptr > ConnectionList; // ... ConnectionList::const_iterator GetC...

UBLAS Matrix Finding Surrounding Values of a Cell?

I am looking for an elegant way to implement this. Basically i have a m x n matrix. Where each cell represents the pixel value, and the rows and columns represent the pixel rows and pixel columns of the image. Since i basically mapped points from a HDF file, along with their corresponding pixel values. We basically have alot of empty p...

How can I tell reliably if a boost thread has exited its run method?

I assumed joinable would indicate this, however, it does not seem to be the case. In a worker class, I was trying to indicate that it was still processing through a predicate: bool isRunning(){return thread_->joinable();} Wouldn't a thread that has exited not be joinable? What am I missing... what is the meaning of boost thread::joi...

How do I invoke a non-default constructor for each inherited type from a type list?

I'm using a boost typelist to implement the policy pattern in the following manner. using namespace boost::mpl; template <typename PolicyTypeList = boost::mpl::vector<> > class Host : public inherit_linearly<PolicyTypeList, inherit<_1, _2> >::type { public: Host() : m_expensiveType(/* ... */) { } private: const ExpensiveType m...

How to create a Boost.Asio socket from a native socket?

I am merely trying to create a boost ip::tcp::socket from an existing native socket. In the assign function, the first parameter must be a "protocol_type" and the second must be a "native_type", but it never explains what these are or gives an example of its use. I'm guessing the second should be the socket descriptor, but I'd really ap...

boost::format question

Consider the following : #include <vector> #include <string> #include <iostream> #include <boost/format.hpp> #include <boost/assign.hpp> #include <boost/assign/list_of.hpp> #include <boost/assign/std/vector.hpp> using namespace std; typedef unsigned char byte; typedef vector<byte> byte_array; const byte_array bytes = list_of(0x05)(0...

How to synchronize and combine results from multiple threads in C++?

I have a data feed continuously feeding data packet in. There are 5 threads(A, B, C, D, E) processing the data packages. Note the 5 threads have totally different speed and they generate 5 different features(each thread generate 1 feature) for every incoming data package. The 5 threads are at different pace: when A has finished analyzin...