boost::join

References

Headers

boost::join is available by including the following header:

  • boost/range/join.hpp

Examples

join.cpp

#include <iostream>
#include <iterator>
#include <list>
#include <vector>

#include <boost/range/join.hpp>


int main() {
    std::string str = "abcde";
    std::vector<char> vec = {'A', 'B', 'C', 'D', 'E'};

    // join() takes two ranges and concatenates them to a single range.
    for (const auto & c : boost::join(str, vec)) {
        std::cout << c;
    }
    std::cout << std::endl;

    return 0;
}

Output:

abcdeABCDE

 

Boost Range for Humans

This reference is part of Boost Range for Humans. Click the link to the overview.