boost::algorithm::join() in C++ Library Last Updated : 09 Mar, 2022 Comments Improve Suggest changes Like Article Like Report The library Boot.StringAlgorithms provides many functions for string manipulations. The string can be of type std::string, std::wstring, or any instance of the class template std::basic_string. boost::algorithm:join(): The join() function in the C++ boost library is included in the library "boost/algorithm/string". This function is used to join two or more strings into one long string by adding a separator between the strings. The strings to be joined are provided in a container like a vector of string. Popular used containers are std::vector<std::string>, std::list<boost::iterator_range<std::string::iterator>. Syntax: join(container, separator) Parameters: container: It contains all the strings which have to be joined.separator: It is a string that separates the joined strings. Example 1: Below is the C++ program to implement the above approach. C++ // C++ program for the // above approach #include <boost/algorithm/string.hpp> #include <iostream> using namespace std; using namespace boost::algorithm; // Function to join 2 or more strings void concatenate(vector<string>& v1) { // Joining the strings with a // whitespace string s1 = boost::algorithm::join(v1, " "); cout << s1 << endl; // Joining the strings with a '$' string s2 = boost::algorithm::join(v1, "$"); cout << s2 << endl; } // Driver Code int main() { // Vector container to hold // the input strings vector<string> v1; v1.push_back("Geeks"); v1.push_back("For"); v1.push_back("Geeks"); // Function Call concatenate(v1); return 0; } OutputGeeks For Geeks Geeks$For$Geeks Example 2: Below is the C++ program to implement the above approach. C++ // C++ program for the above approach #include <iostream> #include <boost/algorithm/string.hpp> using namespace std; using namespace boost::algorithm; // Function to join 2 or more strings void concatenate(vector<string>& v1) { // Joining the strings with // the string "..." string s1 = boost::algorithm::join(v1, "..."); cout << s1 << endl; } // Driver Code int main() { // Vector container to hold the // input strings vector<string> v1; v1.push_back("Geeks"); v1.push_back("For"); v1.push_back("Geeks"); // Function Call concatenate(v1); return 0; } OutputGeeks...For...Geeks Comment More infoAdvertise with us Next Article boost::algorithm::join() in C++ Library S spp____ Follow Improve Article Tags : C++ Programs C++ CPP-Library cpp-boost Practice Tags : CPP Similar Reads How Do I Create a Library in C++? Libraries are reusable code packages that can be imported into our program to use the code defined in them. In C++, libraries can be either static or dynamic. A static library is a library that is linked to the program at compile-time whereas dynamic libraries in C++ are linked at runtime but they h 4 min read How to Join a Thread in C++? In C++, a thread is a basic element of multithreading that represents the smallest sequence of instructions that can be executed independently by the CPU. In this article, we will discuss how to join a thread in C++. How to Join a Thread in C++?Joining a thread is a means to wait for the thread to c 2 min read std::thread::join() in C++ The std::thread::join() is a standard library function in C++ that is used to block the current thread until the thread identified by *this finishes its execution. It means that it will hold the current thread at the point of its call until the thread associated with that join() function finishes it 3 min read Thread joinable() function in C++ Thread::joinable is an in-built function in C++ std::thread. It is an observer function which means it observes a state and then returns the corresponding output and checks whether the thread object is joinable or not. A thread object is said to be joinable if it identifies/represent an active threa 2 min read How to Create a Vector of Pairs in C++? In C++, std::pair is the data type that stores the data as keys and values. On the other hand, std::vector is an STL container that stores the collection of data of similar type in the contiguous memory location. In this article, we will learn how to combine these two to create a vector of pairs in 5 min read Like