boost

Correct use of s/rand or Boost::random

I know this kind of question has been asked a few times, but alot of them answers boil down to RTFM, but I'm hoping if I can ask the right question... I can get a quasi-definitive answer for everyone else as well, regarding implementation. I'm trying to generate a sequence of random numbers in one of the two following ways: #include <c...

Is there any recycling pool structure in C++ Boost?

I need a pool struct that can reuse/recycle the memory after usage, i.e., DON'T do any allocation or deallocation on-the-fly (although you still need to allocate the memory at the moment when the program starts) Boost.Pool does not support such a mechanism; is there any alternative? ...

change command used by bjam when installing C++ boost library

Hi, I am trying to make the installation of boost library a little bit slower. So I add this in /etc/site-config.jam using gcc ; ; "sleep 10; g++" ; However, it gives this error: $ ./bjam install \/etc/site-config.jam:5: syntax error at keyword ; /etc/site-config.jam:5: in load rule sleep 10; g++ unknown in module pch. /t...

Boost asio udp waitForReadyRead

Hello, I am trying to implement a function using boost asio udpSocket, that waits until data is ready to be read, or waits until a timeout expires. using asyc_read and a async_wait, I can do something similar, but I have to read the data. I would like to do the same without reading the data This would allow a much easier use of the ud...

Boost: what is a "convenience header"?

What is the difference between "header" and "convenience header" in boost? ...

Boost: how do we specify "any port" for a TCP server?

How can I specify "pick any available port" for a TCP based server in Boost? And how do I retrieve the port once a connection is accepted? UPDATED: By "available port" I mean: the OS can pick any available port i.e. I do not want to specify a port. ...

Anyone here has benchmarked Intel C++ compiler and GCC?

I am not sure whether I should post this question here, because this seems to be a programming-oriented website. Anyway, I think there must be some gurus here who knows this. Now I have a AMD Opteron server running CentOS 5. I want to have a compiler for a fairly large c++ Boost based program. Which compiler I should choose? ...

Has anyone seen a 2-Sat implementation

I have been looking for a while, but I just can't seem to find any implementation of the 2-Sat algorithm. I am working in c++ with the boost library (which has a strongly connected component module) and need some guidance to either create an efficient 2-Sat program or find an existing library for me to utilise through c++. ...

How do I integrate Boost into a Visual C++ project?

Hi all, I'm trying to link up some of the boost stuff with a visual C++ project of mine and am not sure what the best way to do this is, I'm specifically interested in the singleton class. ...

When trying to include '#include <boost/regex.hpp>' I get: 1>LINK : fatal error LNK1104: cannot open file 'libboost_regex-vc100-mt-gd-1_39.lib'

Not sure why i get that, I downloaded libs from here and while I have a lib called 'libboost_regex-vc90-mt-gd-1_39.lib I don't have one which is called 'libboost_regex-vc100-mt-gd-1_39.lib', renaming the one with vc90 to vc100 works but I'm not sure if this is the ideal solution? ...

boost::thread causing small event handle leak?

I'm debugging this database project. It wraps access to SQLite for a higher level application. It's designed to run asynchronously, that is, it has methods like ExecuteRequestAsync() and IsRequestReady(). When ExecuteRequestAsync is called, it spawns a boost::thread to do the job and return the function immediately. When the higher level...

Boost Multi-Index with hashed_unique_index produces compiler error

Hello, I learned in THIS THREAD how a hashed_unique<> index can be used with a composite_key using an int and a std::vector<int>. But unfortunately the following code produces quite an error message: 1> boost/multi_index/hashed_index.hpp(439) : error C2784: 'size_t .. composite_key_hash<...>::operator ()(const boost::tuples::tuple<......

std::locale breakage on MacOS 10.6 with LANG=en_US.UTF-8

I have a C++ application that I am porting to MacOSX (specifically, 10.6). The app makes heavy use of the C++ standard library and boost. I recently observed some breakage in the app that I'm having difficulty understanding. Basically, the boost filesystem library throws a runtime exception when the program runs. With a bit of debugging...

How do I "normalize" a pathname using boost::filesystem?

We are using boost::filesystem in our application. I have a 'full' path that is constructed by concatenating several paths together: #include <boost/filesystem/operations.hpp> #include <iostream>   namespace bf = boost::filesystem; int main() { bf::path root("c:\\some\\deep\\application\\folder"); bf::path subdir("..\\conf...

Boost.Python + OpenGL segmentation faults

I have a (almost) perfectly working C++ code written with Boost.Python. It wraps a shared pointer based structure hierarchy of 3 or 4 classes, nothing terribly complex (i.e. class A has a std::vector of class B instance pointers, etc.), top level package called, say, foo. Some time ago I decided to add visualization to the project using...

boost::format - attempting to use HTML as formatter string - need some help

Hi all, I'm attempting to use boost::format, where my formatting string is the HTML below. I intend to insert 3x std::strings at locations specified by %s placeholders. In other words - I'm opening the below *.html file for reading, read it's contents into a single std::string and use it as the formatter. Next I'm attempting to do the f...

Memory leak using multiple boost::connect on single slot_type

Hi, I'm using boost::signals and leaking memory when I try to connect multiple signals to a single slot_type. I've seen this same leak reported on various forums, but can't find any that mention the correct way to do this, or any workaround. What I am trying to do: I am trying to pass the result of boost::bind() into a function. In th...

How to hook up Boost serialization & iostreams to serialize & gzip an object to string?

Hi all; I've been using the Boost serialization library, which is actually pretty nice, and lets me make simple wrappers to save my serializable objects to strings, like so: template <class T> inline std::string saveString(const T & o) { std::ostringstream oss; boost::archive::binary_oarchive oa(oss); oa << o; return oss.str(); } te...

Supressing warnings for a codeblock using gcc 4.1.2?

I have a section of code that uses a Boost library that results in a lot of these type of warning messages: class x has virtual functions but non-virtual destructor Using g++ 4.1.2, how do I temporarily disable warnings for this codeblock then enable them again after it. Everything I try (pragma gcc diagnostic, etc) seems to only be ...

C++ boost shared array swapping pointers (simple question)

Hi all, I'm new to boost shared arrays. There is existing code that declares two arrays: boost::shared_array<unsigned char> src; boost::shared_array<unsigned char> dest; All I want to do is swap what each array is pointing to (src becomes dest, and dest becomes src). As I understand it, the shared_array.get() method returns a poin...