[C++] Do you use Boost?

Started by
24 comments, last by Baraclese 18 years, 9 months ago
Quote:Original post by MrEvil
I recommend/use boost::spirit, boost::thread, boost::lambda, phoenix, boost::lexical_cast, boost::shared_ptr (occasionally), boost::filesystem and boost::datetime.


hmmm you left you out boost::mpl & boost preprocessor [grin].
Advertisement
Quote:Original post by Lord Maz
Still haven't got boost to install correctly, but I would use it if I could.

I had trouble setting boost up myself, but here is a link where Fruny explains how to do it step by step. Linky

I just recently started using boost myself, I've really only used a few of its smart ptrs and the dynamic bitset so far, but I'm already convinced that its definately worth learning.

hth.
moe.ron
moe.ron
Mm, I've done those things but I guess my path is screwed up or something because it doesn't work for the reasons i explained above. Anyhow, it seems that I can use quite a lot of boost juice without doing any compiling; when I got the include paths right it worked for arrays, shared pointers and some other stuff I tried. Very nice tools.
-Lord Maz-
Yea you can use a lot of the functionality without building it. I think just filesystem, parsing, and a few others actually need to build. I just built mine yesterday but I've been using it for about two months
moe.ron
I'd probably use some of it if I could get it installed. On windows, bjam failed to install. On BSD, the OS provided package failed to compile even the most basic example code with some manner of templating error.

I just took it as a sign, and will try again later, when I'm feeling an abundance of patience.
Quote:Original post by Lord Maz
Still haven't got boost to install correctly, but I would use it if I could.
Quote:Original post by Lord Maz
I am using mingw (the version that comes with dev-c++) but calling bjam and including the root path gives me a couple of hundred errors. It nags alot about VC++ mumbo-jumbo - maybe because I'm also using the VC++ compiler?


I had the same problem (without VC++ installed even), and ignored boost for a while. Later (a few months ago) when I really wanted some of the stuff in there, I googled around for a few hours and found an obscure post on one of the boost mailing lists by someone with the same problem (I think posted in 2004, not sure).
They never actually found out what the problem was, but it turned out that compiling it from MSYS (available from the MinGW site if you haven't installed it yet, it's optional) was a workaround. Works for me, but I'm not really happy about all the time it cost me to find out about it [headshake]. Hope this helps.
You don't have to compile it to use about 80% of the library.
multiarray, for example, is template code.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
I've used some things in boost.. such as regex, graph, smart_ptr, and serialization. Most of their libraries are straightforward and easy to use.

However, there are some that are just absolute abuses of C++ and templates in particular (IMHO).. And others can be notoriously complex, like the boost:graph library, for which there is actually a 300+ page book + CD-ROM on how to use it.

Properly used, I don't have anything against boost. However, as with any libraries/classes, use it wisely. I was recently on a development team who would use boost objects for everything they could. One component they wrote was a dataset class which functioned like a virtual table. During system tests they found that to populate the dataset with 100 fields and 50000 rows would take 40 seconds, and sucked up 50MB of RAM so they called me to take a look at it. Boost EVERYWHERE. As a proof of concept, I re-wrote the class in 4 hours to use simple stl lists/vectors and other basic classes, while maintaining the same functionality and interface. The difference? The test ran in under a second and used less than 5MB of memory.

I realize this is an extreme case, but after seeing how some people abuse 3rd-party libraries claiming it will "solve all their problems" really makes me consider them a last resort.

This is just my opinion.. using good quality 3rd-party libraries rather than reinventing the wheel is generally a good thing. Just be sure to use them wisely.
- Boost.Bind is so much better than std::bind(1st|2nd) that I'd consider it a requirement for anyone trying to use STL-style programming.
- Boost.Shared_Ptr is often the easiest, decently-performing way to deal with heap memory.
- Boost.Filesystem is possibly the best way to use files, since there's no portable way to do many things it does. Same with Boost.Date_Time.
- Boost.Function ( with Boost.Bind or Boost.Lambda ) makes callbacks so much easier to use.
- Boost.Conversion is an extremely convenient wrapper for simple string->data or data->string conversion. Boost.Format can also be used for more precise formatting of data->string without needing explicit streams or manipulators.

In Short: Use it.

Fury does have a point though. Use it when it's helpful, not 'cause it's "cool".
OK well so far we have lots of posts from people who use boost.
Here's one from someone who doesn't use boost...

For starting new things I might consider using it, although I'd have a lot of learning ahead of me. However most of my work involves maintaining existing systems, which I certainly wont be adding boost to, as I couldn't possibly justify it.

I'm interested in learning how some of it works. I'm one who likes to fairly well understand how something works before I make thorough use of it.

I'm sure that it's multidimensional array is great, though I'm also very capable of writing my own too, or using other existing tools.
"In order to understand recursion, you must first understand recursion."
My website dedicated to sorting algorithms

This topic is closed to new replies.

Advertisement