boost

How to use a BGL directed graph as an undirected one (for use in layout algorithm) ?

Hi I am working on a directed graph (actually a bidirectional one) with Boost.Graph. I'd like to use the layout algorithms that exist (either Kamada-Kawai or Fruchterman-Reingold) but they only accept undirected graphs as parameters. What is the simplest way to use these layout algorithms ? More generally, what's the right way to lure ...

C++ serialization of complex data using Boost

Hi, I have a set of classes I wish to serialize the data from. There is a lot of data though, (we're talking a std::map with up to a million or more class instances). Not wishing to optimize my code too early, I thought I'd try a simple and clean XML implementation, so I used tinyXML to save the data out to XML, but it was just far to...

Boost exception at runtime

Hi, Using this code: #include <fstream> #include <boost/archive/text_oarchive.hpp> using namespace std; int main() { std::ofstream ofs("c:\test"); boost::archive::text_oarchive oa(ofs); } I'm getting an unhandled exception at runtime on executing the boost archive line: boost::exception_detail::clone_impl<boost::except...

using string iterators over char* in boost regex

I am trying to search a char* to find matches and store each match as a struct using boost regex. I do not know how to use the std::string iterators over char*. So I created std::string from char* and using them. But now I want pointers in the original char* which can only be found using std::string I created. See the following code. The...

map complex find operation

I want to do the following: Define a map between a string and any kind of object (may be a list, integer - anything). The keys to the map can be as follow (the values are, again, not important): "AAA/123" ==> 1 "AAA/" ==> 2 "BBB/" ==> 3 "CCC/*" ==> 4 "CCC/123" ==> 5 Now, the trick is I want to find the right values given the following st...

linking to boost regex in gcc

i am trying to compile my program which uses regex on linux. I built the boost library in the libs/regex/build by typing make -fgcc.mak which created a directory gcc which contains the following four files boost_regex-gcc-1_35 boost_regex-gcc-d-1_35 libboost_regex-gcc-1_35.a libboost_regex-gcc-d-1_35.a Now I want to use regex ...

Boost considered harmful?

Lots of the answers to C++ questions here contain the response: "You should be using boost::(insert your favourite smart pointer here) or even better boost::(insert your favourite mega complex boost type here)" I'm not at all convinced that this is doing any favours to the questioners who, by and large, are obvious C++ novi...

smart pointers (boost) explained

What is the difference between the following set of pointer? When do you use each pointer in a production code, if at all? Examples would be appreciated! 1.scoped_ptr 2.shared_ptr 3.weak_ptr 4.intrusive_ptr Edit#1 Do you guys use boost in production code? ...

Does using boost pointers change your OO design methodology?

After switching from C++ to C++ w/boost, do you think your OOD skills improved? Do you notice patterns in "Normal" C++ code that you wouldn't consider that you've switched, or do you find that it enables a more abstract design? I guess I'm really wondering if you just use it as a tool, or if you change your entire approach to OO desi...

Compiling with operator() under GCC 3.3 Problem in Boost

Hi, I have the following snippet: #include <boost/random/lognormal_distribution.hpp> #include <boost/random/lagged_fibonacci.hpp> int main() { const double mean = 0.0; const double sigma = 1.0; boost::lognormal_distribution<double> lognorm_dist(mean, sigma); boost::lagged_fibonacci44497 engine; // the following line giv...

How to pass and then invoke generic callback functions without causing circular dependency.

Couldn't creatively shorten the title :) I have been using a variation of the below solution, however I always wondered if there is a better/cleaner way to implement it. I am looking for non-boost solution. We can, though, look at the implementation of boost and C++0x, as it will soon be relevant. //Notice the use of template template...

What are the Best Components of Boost?

I've been browsing revision 1.38.0 of the Boost libraries, in an attempt to decide if there are enough jewels there to justify negotiating my company's external software approval process. In the course of writing test programs and reading the documents, I've reached a couple conclusions of course, not everything in Boost will ever be o...

How boost.asio discover which port is my server app listening on?

it is a little bit strange to me that boost.asio doesn`t use basic concept when client app connecting to the server - using IP address and port. May be I am a little bit noobie in Boost - and I accept that - but anyway I do not understand. So, I have code like this to get client connected to the server on the localhost: boost::...

I need platform-independent version of CharToOem. Does Boost have any?

I need to convert string to support multi-language messaging in my client-server app. Can I find it in boost? ...

accessing member variable of boost thread object

I'm using an object to start boost thread and it has some public member variables which I modify in the thread (in the () operator). How can I access the object's member variables from outside the thread? I tried using a mutex (defined in the object's class) that is locked both in the operator() of the object and from outside, but it do...

Why is boost so heavily templated?

There are many places in boost where I see a templated class and can't help but think why the person who wrote it used templates. For example, the mutex class(es). All the mutex concepts are implemented as templates where one could simply create a few base classes or abstract classes with an interface that matches the concept. edit aft...

Doxygen documentation for the Boost libraries?

Is there doxygen documentation of the Boost libraries somewhere on the web? I could create my own, but I think it should already exist somewhere on the web? Thanks! ...

Boost Version Numbers

Hello, I don't understand why version numbers of the Boost Library are incremented only 1/100 (e.g. 1.33, 1.34, so on) even though major inclusions are made like huge libraries. Is there any strong motivation behind this? ...

Using Boost with Cygwin on Windows

This shoud be a simple problem for users more advanced than I am. :-) How do I use the boost library with cygwin on windows? I am programing with g++ using cygwin on a winxp machine. I need modified Bessel functions of the second order, so I downloaded the latest version of the boost library and installed it in 'c:\cygwin\lib\boost_ 1_...

Numerical range iterators in boost?

I'm aware of the range iterators in boost, and as for this reference, it seems there should be an easy way of doing what I want, but it's not obvious to me. Say I want to represent a numerical range, 0 to 100 (inclusive or not), say range(0,100). I would like to do something like: for_each(range<int>(0,100).begin(), range<int>(0,100).e...