Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use boost C++ libraries? [duplicate]

Tags:

c++

boost

Possible Duplicate:
Boost Library

Often when I was trying (and failing) a C++ project I run into Boost when browsing the web. I tried reading the Boost website, but there was no good short description why to use Boost and what it exactly is.

One of the things that I like a lot about Python is that everything is built-in and cross-platform, web requests, email, XML, JSON, etc. Is this also the case with Boost?

So, enough rant, my concrete answer-able questions:

  • What exactly is Boost?
  • What are the most import reasons to use Boost?
  • Is it fully cross-platform?
  • Is it more "safe" then regular home-brew code where you quickly overlook that one buffer overflow, etc?
  • Is there any link to a page describing all the modules of Boost in one or two sentences?
like image 729
orlp Avatar asked Jan 13 '11 16:01

orlp


2 Answers

What exactly is Boost?

Boost is a collection of useful and extremely high-quality libraries for C++ that complement the rather small standard library.

What are the most import reasons to use Boost?

Boost offers high-quality tools that are missing from C++. Their use is extremely varied though so whether Boost is for you depends entirely on your needs. But I can safely say that every large enough C++ code base would benefit from using Boost.

Some of the most versatile parts are the shared_ptr (a reference-counting smart pointer that helps prevent memory leaks in pointer-rich code), array which provides a very convenient wrapper around C-style arrays of fixed size and other small odd bits which have been integrated into the next C++ standard.

Is it fully cross-platform?

Almost always yes. This is one of the main qualities of Boost.

Is there any link to a page describing all the modules of Boost in one or two sentences?

There is indeed.

like image 115
Konrad Rudolph Avatar answered Sep 28 '22 08:09

Konrad Rudolph


1) Boost is a set of APIs, developed by some of the best minds in C++. You can use as much or as little a you want. Each API targets, and solves a particular paradigm. For example:

lexical_cast<>  - Type-safe ways of casting from one type to another. program_options - Library for parsing command lines in a type-safe manner asio            - Asynchronous Input/Output.  Great for working with sockets, IP4/IP6 shared_ptr      - Reference-counted smart pointer 

... and many more.

2) One of the most important reasons to use Boost is that the great developers that have done this, have, well done it. These solutions are peer-reviewed and robust. If you have a problem to solve and Boost has an API that fits the bill, chances are you should be using it.

3) It's about as cross-platform as you're going to get. i.e, yes.

4) I would use boost over anybody's home-brewed code. Homebrew tends to get used by a single developer (the person that coded it). Boost is in use in commercial applications everywhere and as I said earlier, it's peer-reviewed. You don't get much more robust than that.

5) The main boost page has a list of libraries by function and alphabetically.

like image 28
Moo-Juice Avatar answered Sep 28 '22 08:09

Moo-Juice