Use delimiter.c_str()
as the delimiter:
copy(x.begin(),x.end(), ostream_iterator<int>(s,delimiter.c_str()));
That way, you get a const char*
pointing to the string, which is what ostream_operator
expects from your std::string
.
More Related Contents:
- splitting a string into an array in C++ without using vector
- How to pass a vector of strings to execv
- cannot convert ‘std::string’ to ‘char**’ for argument ‘1’ to ‘__ssize_t getline(char**, size_t*, FILE*)’
- How to enforce move semantics when a vector grows?
- What is the easiest way to initialize a std::vector with hardcoded elements?
- How do I iterate over cin line by line in C++?
- Will std::string always be null-terminated in C++11?
- std::vector versus std::array in C++
- Best way to extract a subvector from a vector?
- c++ vector size. why -1 is greater than zero
- Arrays vs Vectors: Introductory Similarities and Differences [closed]
- stringstream, string, and char* conversion confusion
- Vectors and polymorphism in C++
- Does vector::erase() on a vector of object pointers destroy the object itself?
- Vectors in Arduino
- Does std::vector *have* to move objects when growing capacity? Or, can allocators “reallocate”?
- Convert a string to a date in C++
- Most optimized way of concatenation in strings
- Initializer-list-constructing a vector of noncopyable (but movable) objects
- array vs vector vs list
- How to read a file into vector in C++?
- C++ function to count all the words in a string
- Is std::vector memory freed upon a clear?
- Why doesn’t std::string provide implicit conversion to char*?
- Getting a vector into a function that expects a vector
- Convert double to string C++? [duplicate]
- How can I make the map::find operation case insensitive?
- Initializing a ublas vector from a C array
- Where are string literals stored, and can I modify them?
- C++ trying to swap values in a vector