A good example for boost::algorithm::join

#include <boost/algorithm/string/join.hpp> #include <vector> #include <iostream> int main() { std::vector<std::string> list; list.push_back(“Hello”); list.push_back(“World!”); std::string joined = boost::algorithm::join(list, “, “); std::cout << joined << std::endl; } Output: Hello, World!

How to link C++ program with Boost using CMake

In CMake you could use find_package to find libraries you need. There usually is a FindBoost.cmake along with your CMake installation. As far as I remember, it will be installed to /usr/share/cmake/Modules/ along with other find-scripts for common libraries. You could just check the documentation in that file for more information about how it works. … Read more

Best documentation for Boost:asio?

Some nice documentation on boost including a chapter on asio can be found in a (free) boost book at http://en.highscore.de/cpp/boost/index.html. The chapter on asio provides a general overview and then goes as far as how to develop your own custom asio extensions. Really fantastic effort by Boris Schäling!

What is the purpose of a single pound/hash sign (#) on its own line in the C/C++ preprocessor?

A # on its own on a line has no effect at all. I assume it’s being used for aesthetic value. The C standard says: 6.10.7 Null directive Semantics A preprocessing directive of the form # new-line has no effect. The C++ standard says the same thing: 16.7 Null directive [cpp.null] A preprocessing directive of … Read more

Boost Statechart vs. Meta State Machine

As there seems to be much interest, please allow me to give my (obviously biased) opinion, which should therefore be taken with a grain of salt: MSM is much faster MSM requires no RTTI or anything virtual MSM has a more complete UML2 support (for example internal transitions, UML-conform orthogonal regions) MSM offers a descriptive … Read more

Is it smart to replace boost::thread and boost::mutex with c++11 equivalents?

There are several differences between Boost.Thread and the C++11 standard thread library: Boost supports thread cancellation, C++11 threads do not C++11 supports std::async, but Boost does not Boost has a boost::shared_mutex for multiple-reader/single-writer locking. The analogous std::shared_timed_mutex is available only since C++14 (N3891), while std::shared_mutex is available only since C++17 (N4508). C++11 timeouts are different … Read more