mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-25 22:47:23 +00:00
Fix perfect forwarding
This commit is contained in:
parent
95c964673d
commit
013b6e68ec
@ -156,14 +156,14 @@ public:
|
|||||||
|
|
||||||
// Return inserted node or null if rejected
|
// Return inserted node or null if rejected
|
||||||
template<class T, class ...Args>
|
template<class T, class ...Args>
|
||||||
T *emplace(string_view name, Args &...args) {
|
T *emplace(string_view name, Args &&...args) {
|
||||||
return iter_to_node<T>(insert(children.find(name), type_id<T>(),
|
return iter_to_node<T>(insert(children.find(name), type_id<T>(),
|
||||||
[&](auto _) { return new T(std::forward<Args>(args)...); }));
|
[&](auto _) { return new T(std::forward<Args>(args)...); }));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return inserted node, existing node with same rank, or null
|
// Return inserted node, existing node with same rank, or null
|
||||||
template<class T, class ...Args>
|
template<class T, class ...Args>
|
||||||
T *emplace_or_get(string_view name, Args &...args) {
|
T *emplace_or_get(string_view name, Args &&...args) {
|
||||||
return iter_to_node<T>(insert(children.find(name), type_id<T>(),
|
return iter_to_node<T>(insert(children.find(name), type_id<T>(),
|
||||||
[&](auto _) { return new T(std::forward<Args>(args)...); }, true));
|
[&](auto _) { return new T(std::forward<Args>(args)...); }, true));
|
||||||
}
|
}
|
||||||
@ -205,7 +205,7 @@ protected:
|
|||||||
map_iter insert(map_iter it, uint8_t type, Func fn, bool allow_same = false);
|
map_iter insert(map_iter it, uint8_t type, Func fn, bool allow_same = false);
|
||||||
|
|
||||||
template<class To, class From = node_entry, class ...Args>
|
template<class To, class From = node_entry, class ...Args>
|
||||||
map_iter upgrade(map_iter it, Args &...args) {
|
map_iter upgrade(map_iter it, Args &&...args) {
|
||||||
return insert(it, type_id<To>(), [&](node_entry *&ex) -> node_entry * {
|
return insert(it, type_id<To>(), [&](node_entry *&ex) -> node_entry * {
|
||||||
if (!ex)
|
if (!ex)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user