Skip to content

Commit 3c36fce

Browse files
committed
Eliminate warnings
1 parent 1810344 commit 3c36fce

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

include/ustr/ustr.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -445,14 +445,9 @@ inline std::string tuple_to_string_impl(const Tuple& tuple, index_sequence<Indic
445445
std::ostringstream ss;
446446
ss << "(";
447447
bool first = true;
448-
// C++11 compatible element processing using recursive template expansion
449-
auto process_elements = [&ss, &first](const std::string& element) {
450-
if (!first) ss << ", ";
451-
first = false;
452-
ss << element;
453-
};
454448
// Use initializer list expansion for C++11 compatibility with quotation support
455-
(void)std::initializer_list<int>{(process_elements(apply_quotation_if_needed(std::get<Indices>(tuple))), 0)...};
449+
(void)std::initializer_list<int>{((first ? (first = false, ss) : (ss << ", ")) << apply_quotation_if_needed(std::get<Indices>(tuple)), 0)...};
450+
(void)first; // Suppress unused variable warning for empty tuples
456451
ss << ")";
457452
return ss.str();
458453
}

include/utest/utest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ namespace details {
268268
inline std::string to_string_for_str_assert(const char* s) { return std::string(s); }
269269
inline std::string to_string_for_str_assert(char* s) { return std::string(s); }
270270
inline std::string to_string_for_str_assert(const std::wstring& s) { return std::string(s.begin(), s.end()); }
271-
inline std::string to_string_for_str_assert(const wchar_t* s) { return std::string(); } // Not implemented
271+
inline std::string to_string_for_str_assert(const wchar_t* /*s*/) { return std::string(); } // Not implemented
272272
template<typename T>
273273
inline std::string to_string_for_str_assert(const T& s) { return convertToString(s); }
274274

tests/ustr_quoted_str_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ UTEST_FUNC_DEF2(QuotedStr, StartEndDelimitersComplex) {
180180

181181
// Tests for is_utf8 parameter
182182
UTEST_FUNC_DEF2(QuotedStr, UTF8Enabled) {
183-
std::string result = ustr::quoted_str("Hello 世界! 🌍", '"', '"', '\\\\', true);
183+
std::string result = ustr::quoted_str("Hello 世界! 🌍", '"', '"', '\\', true);
184184
UTEST_ASSERT_STR_EQUALS(result, "\"Hello 世界! 🌍\"");
185185
}
186186

0 commit comments

Comments
 (0)