xtd 0.2.0
Loading...
Searching...
No Matches
__tunit_join__items.hpp
Go to the documentation of this file.
1
4#pragma once
6#if !defined(__XTD_TUNIT_INTERNAL__)
7#error "Do not include this file: Internal use only"
8#endif
10
11//#include "__default_insert_basic_ostream_operator.hpp"
12#include <sstream>
13#include <string>
14
16template<typename collection_t>
17std::string __tunit_join__items(const collection_t& collection) {
18 std::stringstream ss;
19 ss << "< ";
20 bool first = true;
21 for (const auto& item : collection) {
22 if (!first) ss << ", ";
23 ss << __tunit_to_string(item);
24 first = false;
25 }
26 ss << " >";
27 return ss.str();
28}
29
30template<>
31inline std::string __tunit_join__items<std::string>(const std::string& collection) {
32 std::stringstream ss;
33 ss << "< ";
34 bool first = true;
35 for (const char& item : collection) {
36 if (!first) ss << ", ";
37 ss << '\'' << item << '\'';
38 first = false;
39 }
40 ss << " >";
41 return ss.str();
42}