I am wondering if there is way that std::cout automatically will insert some predefined value between printed sequences.
For example:
st
If you're just looking for a way to print a vector with its elements properly delimited (and without an extra delimiter at the end), try this:
#include
#include
int main()
{
std::vector v{1, 2, 3};
auto it = v.begin();
if (it != v.end())
{
std::cout << *it;
++it;
}
for (; it != v.end(); ++it)
{
std::cout << ", " << *it;
}
}