From 9d61e52459906437223d616727d58368aff5022a Mon Sep 17 00:00:00 2001 From: yaojun <940334249@qq.com> Date: Fri, 6 Feb 2026 00:33:54 +0800 Subject: [PATCH] fix: use std::move when pass by value --- requirements.txt | 1 + src/iceberg/util/config.h | 7 +++++-- src/iceberg/util/lazy.h | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index b8d35cbc9..8e5ab9ca0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ meson==1.3.0 ninja==1.13.0 mkdocs==1.6.1 mkdocs-material==9.6.22 +pre-commit==4.5.1 diff --git a/src/iceberg/util/config.h b/src/iceberg/util/config.h index 5adbc96d9..df92561b2 100644 --- a/src/iceberg/util/config.h +++ b/src/iceberg/util/config.h @@ -67,10 +67,13 @@ class ConfigBase { template class Entry { public: - Entry(std::string key, const T& val, + Entry(std::string key, T val, std::function to_str = internal::DefaultToString, std::function from_str = internal::DefaultFromString) - : key_{std::move(key)}, default_{val}, to_str_{to_str}, from_str_{from_str} {} + : key_{std::move(key)}, + default_{std::move(val)}, + to_str_{std::move(to_str)}, + from_str_{std::move(from_str)} {} private: const std::string key_; diff --git a/src/iceberg/util/lazy.h b/src/iceberg/util/lazy.h index 530fb6cfd..1b3506782 100644 --- a/src/iceberg/util/lazy.h +++ b/src/iceberg/util/lazy.h @@ -38,10 +38,10 @@ class Lazy { template struct Trait { - using ReturnType = R::value_type; + using ReturnType = typename R::value_type; }; - using T = Trait::ReturnType; + using T = typename Trait::ReturnType; public: template