This is an automated email from the ASF dual-hosted git repository.

gangwu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-cpp.git


The following commit(s) were added to refs/heads/main by this push:
     new 239e2551 refactor: remove obsolete format string workaround (#448)
239e2551 is described below

commit 239e25510ae5ea88715c52e49799809fb73d9849
Author: Xinli Shang <[email protected]>
AuthorDate: Sun Dec 28 22:00:29 2025 -0800

    refactor: remove obsolete format string workaround (#448)
    
    Remove workaround for old Clang/libc++ bug where "<{}>" in format
    strings was incorrectly parsed. Modern compilers handle this correctly.
    
    Changes:
    - Simplify ListType::ToString() to use direct format string
    - Simplify MapType::ToString() to use direct format string
    - Remove XXX comments about the workaround
    
    The existing tests will verify this works correctly on current
    compilers.
---
 src/iceberg/type.cc | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/src/iceberg/type.cc b/src/iceberg/type.cc
index 44512c0d..99b3433b 100644
--- a/src/iceberg/type.cc
+++ b/src/iceberg/type.cc
@@ -150,14 +150,7 @@ ListType::ListType(int32_t field_id, std::shared_ptr<Type> 
type, bool optional)
     : element_(field_id, std::string(kElementName), std::move(type), optional) 
{}
 
 TypeId ListType::type_id() const { return kTypeId; }
-std::string ListType::ToString() const {
-  // XXX: work around Clang/libc++: "<{}>" in a format string appears to get
-  // parsed as {<>} or something; split up the format string to avoid that
-  std::string repr = "list<";
-  std::format_to(std::back_inserter(repr), "{}", element_);
-  repr += ">";
-  return repr;
-}
+std::string ListType::ToString() const { return std::format("list<{}>", 
element_); }
 
 std::span<const SchemaField> ListType::fields() const { return {&element_, 1}; 
}
 Result<std::optional<NestedType::SchemaFieldConstRef>> ListType::GetFieldById(
@@ -213,13 +206,7 @@ const SchemaField& MapType::value() const { return 
fields_[1]; }
 TypeId MapType::type_id() const { return kTypeId; }
 
 std::string MapType::ToString() const {
-  // XXX: work around Clang/libc++: "<{}>" in a format string appears to get
-  // parsed as {<>} or something; split up the format string to avoid that
-  std::string repr = "map<";
-
-  std::format_to(std::back_inserter(repr), "{}: {}", key(), value());
-  repr += ">";
-  return repr;
+  return std::format("map<{}: {}>", key(), value());
 }
 
 std::span<const SchemaField> MapType::fields() const { return fields_; }

Reply via email to