I've used Boost graph library a fair amount but not much of the rest of it. I frequently see recommendations here to use parts of Boost (say, Boost's various smart pointers). Obviously Boost is good and good to use. It is also large or diverse. Does anyone know of a FAQ or decent best practices doc to help a knowledgeable C++ programmer make better use of Boost?
You might find https://stackoverflow.com/questions/379290/how-to-learn-boost useful.
But in general, keep in mind that Boost is not a library, but a collection of libraries. Which means that you can and should use parts of it, but probably not all of it.
Just read over the list of libraries within Boost, and check the documentation for the specific libraries that sound useful. The Boost website is really the authoritative source, both on what Boost has to offer, and on how it should be used.
Pick out individual libraries that seem useful, and see what the Boost website has to say about them.
I learned the libraries I use by other developers suggesting certain libraries and me reading all the documentation I could find/needed to use the library.
However recently I bought this book, Beyond the C++ Standard, that introduces the most common parts of Boost. Even with reasonable boost experience I found this book really useful. It explains what the the libraries do, why they do it, how to use it and some of the techniques they use to implement it.
When some problem looks like a wheel which was invented already, firstly I look at boost's list of libraries and I trying to use that which will be appropriate for certain task. That's is my way to learn boost.
Related
I'm still in the process of learning C++ concepts, but I'm fairly comfortable with pointers, references, Object Oriented Programming, and other programming basics. But I still need to learn more about templates, iterators, and regular expressions. Are there any other concepts I should have a firm grounding in to get the best use out of Boost libraries?
There is no such thing as "proper" use of Boost. You use that part of Boost that helps you with your problem. For Boost Test, for example, you don't have to know much about anything specific. For Boost Graph or Algorithm, you should have a good grasp of templates.
Hence, there's no good way to answer your question. Look at the documentation of the library you want to use (Boost or otherwise), and if you think you can handle it, use it. Otherwise, come back here and ask a more specific question. ;-)
You should know how templates and inheritancy works and read carefully the documentation of the module you are planning to use. It should be enough for most cases.
Hard to say since boost is really a collection of libraries. You should have knowledge of the problem domain before using a library. For example, what are threads and how to deal with them before using boost.thread.
As for C++ specific stuff:
You should know what the standard library already provides you.
Have a firm grasp on how to use templates
I have seen lots of people suggesting the Boost library on Stack Overflow, so I am also thinking of learning it. But today I came across this link: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Boost
I wanted to know about its acceptance in industry at a broader level. My current company also doesn't allow me to use this so I am confused whether to look into this or not.
Parts of Boost library is currently being accepted into the Standard library for C++0x and it is regarded as one of the top libs with a high industry acceptance. I'm actually unaware of any other library getting accepted into the C++ Standard Library on such a large scale.
"Ten Boost libraries are already included in the C++ Standards Committee's Library Technical Report (TR1) and will be in the new C++0x Standard now being finalized. C++0x will also include several more Boost libraries in addition to those from TR1. More Boost libraries are proposed for TR2."
You should definately look into this. Don't go by Google or any other large institution. They generally have to work to a subset of any complex language like C++. Hence, they'll have restrictions on which parts they can use so that it's easier to hire and train engineers to use the code base.
Additionally, Boost leverages many aspects of the higher forms of functionality within C++, case in point template meta-programming. Boost provides for a safer, though bulkier, form of functions as first class objects. They add in a more powerful "bind" which works so well with the standard library that I'd be lost without it. Finally, they have in place tuples and hash tables, both fundamental datatypes in modern development libraries.
In short, I really can't name one reason why you wouldn't want to look at Boost, even just to learn something. It's peer reviewed and largely platform independent. The source code is a treasure trove of information and more advanced programming techniques.
I think the who is using boost web page speaks for itself. Notably: Adobe, McAfee, and Real Networks probably qualify as industry.
My current company also does not allow me
to use [boost]. So I am confused whether
to look into it or not.
You might want to dig a little further and find out why. As others have said, Boost is a fantastically useful set of open source and peer reviewed libraries of extremely high quality. Look at their development LOC chart for an idea how long and how much $$ it would cost your company to reinvent the wheel.
Edit: What I'm really thinking of is a C++ equivalent to the Contrib libraries other languages enjoy, like CPAN/PyPI/Ruby Gems
Suppose I want a collection type that isn't really supported by anything in the STL or by BOOST, like a spacial index or a fibonacci tree (if i think that might be useful on my really big dataset). Is there a good place to find these kinds of less common tools?
Sometimes Vault has useful things. maybe you can find something there.
As it is said, google is your friend :-)
It appears that here (http://resnet.uoregon.edu/~gurney_j/jmpc/fib.html) is an implementation of Fibonacci heap in C. Check it out, and if you like it, may be you can translate/modify/improve to a C++.
Well, I don't know if there are any actual 'collections of libraries', but i'll start a list of useful libraries. (C++ libs only, please)
There's Boost, obviously, but also Boost Vault, which appears to contain libraries that aren't quite ready for inclusion in Boost proper. (thanks aaa carp for pointing this out)
GMP, an arbitrary precision number library, has C++ bindings
Qt, which is about as old as the moon, but also modern enough to still be useful. This of course is a heavy handed application library, but there's no real reason not to use whatever parts could be useful. I'm not too sure how esoteric that really is, though. Outside of the GUI portions, most functionality would already be duplicated by boost.
libCurl has c++ bindings, for http access (and other things)
I'm coming to C++ from a .Net background. Knowing how to use the Standard C++ Libraries, and all the syntax, I've never ventured further. Now I'm looking learning a bit more, such as what libraries are commonly used? I want to start getting into Threading but have no idea to start. Is there a library (similar to how .net has System.Threading) out there that will make it a bit easier? I'm specifically looking to do Linux based network programming.
For C++, Boost is your everything. Threading and networking are among the things it offers. But there's much more:
Smart pointers
Useful containers not found in the STL, such as fixed-size arrays and hashtables
Closures
Date/time classes
A foreach construct
Min/max functions
Command line option parsing
Regular expressions
As the others have said, Boost is great. It implements the C++ Technical Report 1 in addition to tons of other stuff, including some mind-blowing template metaprogramming tricks.
For other cross-platform features not provided by Boost, I've had very good luck with a library called Poco. I've worked on commercial projects that incorporated its simple HTTP server, for instance, and it treated us quite well.
lots of boost suggestions, but Qt is another good option. It's got great support for threading and networking along with pretty much everything else.
http://qt.nokia.com/products
If you are looking into network programming and are not interested into GUI, I suggest Boost libraries: in particular, Asio.
There's no standard multithreading library, but the boost library includes a platform-independent multithreading abstraction that works very well.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I am curious to learn Boost. But I wanted to ask:
How important is it to make the effort to learn Boost?
What prerequisites should one have before jumping on Boost?
Why I am curious to know about Boost is that many people are talking about Boost on IRC's channels and here in StackOverflow.
I think anyone that is seriously considering C++ development as a career should learn Boost, and learn it well. Once you get into serious programming you will realize how beneficial these libraries can be and how much more productive they can make you. Not only are they cross-platform, but once you get into data crunching with large numbers, the math libraries especially will seem like a gift from above.
As a game developer, I've been shocked by how many people don't know about Boost. I've mentioned it to contacts in various game studios and not only is it frequently not used (is licensing or porting it a problem?) but many people haven't even heard of it. This leads me to believe that from a career perspective, it's not actually critical to learn Boost, but from a personal development standpoint, it is definitely vital. :)
Discussed previously: what are the advantages of using the c++ boost libraries.
As for any pre-requisites, you should be familiar with the STL and some experience of templates wouldn't hurt. I'm always amazed at how many C++ programmers don't actually use either the STL or templates.
It's very important, especially as many libraries from Boost are getting into the C++ standard -- by using Boost, you get an early look at how the standard will look like (shared_ptr, anyone?).
Moreover, even if you don't use them, the Boost libraries are very well written and often interesting to look at; they do some really advanced C++.
I feel that boost is such a productivity enhancer that I don't think I would accept a job with a C++ shop not using boost.
A language is a tool. Use it if it helps you accomplish something.
I am so sick of these religions. "Should I use Boost? If I don't use Boost, does that mean I'm not a real C++ programmer? Will other C++ programmers like me?" Please. Any C++ programmer who cares if you use Boost or any other library is a close-minded jerk, and you should have nothing to do with him.
Rather, go find an intelligent, open-minded person who can tell you how Boost and who-knows-what-other library has helped him in his own work. He'll even admit that sometimes you don't need those libraries.
Alternate answer: re-implementing part of Boost or STL yourself is a good way to keep your programming abilities sharp. In other words, a C++ programmer who can't fall back to C because he's without his libraries is a weak programmer.
Boost has rich set of libraries that you get it for free.Get to know what are all the libraries available in boost so that you can use one if there is a need.About learning ,select libraries that are included in c++0X so that you can use it and soon compilers are going to support.About particular library learn it when ever you need.
Judging (scientifically :-) by the huge quantity of questions on SO about C++ which have top-rated answers along the lines of "Use Boost::SomethingOrOther", I would say it's very important.
The thing that drew me from C to Java instead of C++, was the huge quantity of supplied classes in Java. Boost almost manages to convince me to go back, except for the fact that I'm now heavily mired in web services where Java is the lingua franca.
Please remember boost is just a set of libraries which can be used to improve productivity (stop reinventing the wheel).
They are, by all accounts, well written and use techniques that you might not (i.e. defintely won't) think up by yourself. If your intention is to look through the source to learn advanced c++ techniques then knock yourself out but I think I'd buy a good book instead.
On the other hand, if you just want to use some library functions to improve your productivity consider your options. What are you developing and so what sort of libraries do you need?
Our company has cross platform products that use boost extensively but we also have windows only products that use some boost but, for the most part, rely on microsoft's libraries. MS libraries are good quality and have (imo) excellent documentation (part of MS success lies in making windows as easy to program as possible for third party developers). I mention MS specifically as they offer a broad range of libraries for many purposes like boost. We also use numerous other more focused 3rd party libraries (i.e. libraries that provide functionality in one area such as cryptography).