diff options
Diffstat (limited to 'src/util.h')
-rw-r--r-- | src/util.h | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/util.h b/src/util.h index 9084e81..8cbe054 100644 --- a/src/util.h +++ b/src/util.h | |||
@@ -6,31 +6,25 @@ | |||
6 | #include <memory> | 6 | #include <memory> |
7 | 7 | ||
8 | namespace twitter { | 8 | namespace twitter { |
9 | 9 | ||
10 | template <class InputIterator> | 10 | template <class InputIterator> |
11 | std::string implode(InputIterator first, InputIterator last, std::string delimiter) | 11 | std::string implode(InputIterator first, InputIterator last, std::string delimiter) |
12 | { | 12 | { |
13 | std::stringstream result; | 13 | std::stringstream result; |
14 | 14 | ||
15 | for (InputIterator it = first; it != last; it++) | 15 | for (InputIterator it = first; it != last; it++) |
16 | { | 16 | { |
17 | if (it != first) | 17 | if (it != first) |
18 | { | 18 | { |
19 | result << delimiter; | 19 | result << delimiter; |
20 | } | 20 | } |
21 | 21 | ||
22 | result << *it; | 22 | result << *it; |
23 | } | 23 | } |
24 | 24 | ||
25 | return result.str(); | 25 | return result.str(); |
26 | } | 26 | } |
27 | 27 | ||
28 | template<typename T, typename... Args> | ||
29 | std::unique_ptr<T> make_unique(Args&&... args) | ||
30 | { | ||
31 | return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); | ||
32 | } | ||
33 | |||
34 | }; | 28 | }; |
35 | 29 | ||
36 | #endif /* end of include guard: UTIL_H_440DEAA0 */ | 30 | #endif /* end of include guard: UTIL_H_440DEAA0 */ |