/* * Copyright 2015 Cloudius Systems */ #pragma once #include "core/sstring.hh" #include #include template static inline sstring join(sstring delimiter, const PrintableRange& items) { return join(delimiter, items.begin(), items.end()); } template static inline sstring join(sstring delimiter, Iterator begin, Iterator end) { std::ostringstream oss; while (begin != end) { oss << *begin; ++begin; if (begin != end) { oss << delimiter; } } return oss.str(); } template static inline sstring to_string(const std::vector& items) { return "[" + join(", ", items) + "]"; } template static inline sstring to_string(std::initializer_list items) { return "[" + join(", ", std::begin(items), std::end(items)) + "]"; }