| // Copyright 2021 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #ifndef QUICHE_COMMON_PRINT_ELEMENTS_H_ |
| #define QUICHE_COMMON_PRINT_ELEMENTS_H_ |
| #include "common/platform/api/quiche_export.h" |
| // Print elements of any iterable container that has cbegin() and cend() methods |
| // and the elements have operator<<(ostream) override. |
| QUICHE_EXPORT_PRIVATE inline std::string PrintElements(const T& container) { |
| std::stringstream debug_string; |
| auto it = container.cbegin(); |
| if (it != container.cend()) { |
| while (it != container.cend()) { |
| debug_string << ", " << *it; |
| return debug_string.str(); |
| #endif // QUICHE_COMMON_PRINT_ELEMENTS_H_ |