Skip to content

Commit 9d61e52

Browse files
committed
fix: use std::move when pass by value
1 parent 43b83c5 commit 9d61e52

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ meson==1.3.0
22
ninja==1.13.0
33
mkdocs==1.6.1
44
mkdocs-material==9.6.22
5+
pre-commit==4.5.1

src/iceberg/util/config.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,13 @@ class ConfigBase {
6767
template <typename T>
6868
class Entry {
6969
public:
70-
Entry(std::string key, const T& val,
70+
Entry(std::string key, T val,
7171
std::function<std::string(const T&)> to_str = internal::DefaultToString<T>,
7272
std::function<T(const std::string&)> from_str = internal::DefaultFromString<T>)
73-
: key_{std::move(key)}, default_{val}, to_str_{to_str}, from_str_{from_str} {}
73+
: key_{std::move(key)},
74+
default_{std::move(val)},
75+
to_str_{std::move(to_str)},
76+
from_str_{std::move(from_str)} {}
7477

7578
private:
7679
const std::string key_;

src/iceberg/util/lazy.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ class Lazy {
3838

3939
template <typename R, typename... Args>
4040
struct Trait<R (*)(Args...)> {
41-
using ReturnType = R::value_type;
41+
using ReturnType = typename R::value_type;
4242
};
4343

44-
using T = Trait<decltype(InitFunc)>::ReturnType;
44+
using T = typename Trait<decltype(InitFunc)>::ReturnType;
4545

4646
public:
4747
template <typename... Args>

0 commit comments

Comments
 (0)