As an exercise I'm trying to implement Python's str.join
method in C++. I will eventually add the function as a method of the std::string
class but I figure getting it to work is more of a priority. I've defined the function as follows:
template<typename Iterable>
std::string join(const std::string sep, Iterable iter);
Is there any way that I can ensure that the Iterable type is actually iterable? E.g. I wouldn't want to receive an int
or char
..
iterable
is an iterable container, not an iterator? – Galik