OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_QUIC_PLATFORM_IMPL_QUIC_STR_CAT_IMPL_H_ | 5 #ifndef NET_QUIC_PLATFORM_IMPL_QUIC_STR_CAT_IMPL_H_ |
6 #define NET_QUIC_PLATFORM_IMPL_QUIC_STR_CAT_IMPL_H_ | 6 #define NET_QUIC_PLATFORM_IMPL_QUIC_STR_CAT_IMPL_H_ |
7 | 7 |
8 #include <sstream> | 8 #include <sstream> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 | 14 |
15 template <typename... Args> | 15 template <typename... Args> |
16 inline std::string QuicStrCatImpl(const Args&... args) { | 16 inline std::string QuicStrCatImpl(const Args&... args) { |
17 std::ostringstream oss; | 17 std::ostringstream oss; |
18 int dummy[] = {1, (oss << args, 0)...}; | 18 int dummy[] = {1, (oss << args, 0)...}; |
19 static_cast<void>(dummy); | 19 static_cast<void>(dummy); |
20 return oss.str(); | 20 return oss.str(); |
21 } | 21 } |
22 | 22 |
23 template <typename... Args> | 23 template <typename... Args> |
24 inline std::string QuicStringPrintfImpl(const Args&... args) { | 24 inline std::string QuicStringPrintfImpl(const Args&... args) { |
25 return std::move(base::StringPrintf(std::forward<const Args&>(args)...)); | 25 return base::StringPrintf(std::forward<const Args&>(args)...); |
26 } | 26 } |
27 | 27 |
28 } // namespace net | 28 } // namespace net |
29 | 29 |
30 #endif // NET_QUIC_PLATFORM_IMPL_QUIC_STR_CAT_IMPL_H_ | 30 #endif // NET_QUIC_PLATFORM_IMPL_QUIC_STR_CAT_IMPL_H_ |
OLD | NEW |