| 370 | // appended to the returned string. |
| 371 | template <typename Container> |
| 372 | string CommaSeparatedString(const Container& c, const char* prefix = "", |
| 373 | const char* suffix = "") { |
| 374 | // Not using Join() since the implementation here is simple anyway and this |
| 375 | // avoids copying the string to append prefix. |
| 376 | string comma_separated = prefix; |
| 377 | const char* separator = ""; |
| 378 | for (const auto& entry : c) { |
| 379 | absl::StrAppend(&comma_separated, separator, entry); |
| 380 | separator = ", "; |
| 381 | } |
| 382 | comma_separated += suffix; |
| 383 | return comma_separated; |
| 384 | } |
| 385 | |
| 386 | // Overload needed to allow the container to be an initializer list. The default |
| 387 | // type for T makes an empty initializer list work as well. |