#include &lt;sstream&gt;
#include &lt;string&gt;
#include &lt;vector&gt;
#include &lt;iterator&gt;
#include &lt;iostream&gt;

int main()
{
    std::vector&lt;int&gt; data = {42, 1, 2, 3, 4, 5};

    std::ostringstream oss;
    std::copy(data.begin(), data.end(), std::ostream_iterator&lt;int&gt;(oss, ";"));

    std::string result( oss.str() );
    std::cout &lt;&lt; result &lt;&lt; "\n";
}


N.B. In C++11, you can use the more general form

using std::begin;
using std::end;
std::copy(begin(data), end(data), std::ostream_iterator&lt;int&gt;(oss, ";"));


Where the using-declarations are not required if ADL can be used (like in the example above).



Also possible, but maybe a bit less efficient:

std::string s;
for(auto const&amp; e : v) s += std::to_string(e) + ";";


which can be written via std::accumulate in &lt;algorithm&gt; as:

std::string s = std::accumulate(begin(v), end(v), std::string{},
    [](std::string r, int p){ return std::move(r) + std::to_string(p) + ";"; });


(IIRC there was some method to eliminate the copying, maybe by taking the lambda-parameter by reference std::string&amp; r.)



A version w/o the trailing semi-colon (thanks to Dietmar Kühl):

std::vector&lt;int&gt; data = {42, 1, 2, 3, 4, 5};

std::ostringstream out;
if (!v.empty())
{
    std::copy(v.begin(), v.end() - 1, std::ostream_iterator&lt;int&gt;(out, ";"));
    out &lt;&lt; v.back();
}

std::string result( out.str() );
std::cout &lt;&lt; result &lt;&lt; "\n";


Convert vector<int> to delimited string
I have two views, one above another as a child.
View1--->View2 (View1 has View2 as a child)

How can I code this functionality?
1) if user TAPed on View2 - so the proper message tapped: sent to View2;
2) if user just moving finger over the View1(including View2) - events passed to View1 so it can handle touchesBegan: and so on. 

So what I am trying to code is make one function "[View2 tapped:...]" if touch was short, and another function([View1 touchesBegan:..] and so on) if touch is moving.

In my case if I move finger over View2 - it never passes events to View1.

P.s. I did not rewrite hitTest or anything.
