Skip to content
Snippets Groups Projects
Commit 17a6d11b authored by lh1887's avatar lh1887
Browse files

[variant] forward, not move

parent e1d0e5a5
No related branches found
No related tags found
1 merge request!7Fix variant fallback
...@@ -125,10 +125,11 @@ namespace Impl { ...@@ -125,10 +125,11 @@ namespace Impl {
} }
template<typename Tp> template<typename Tp>
void set(Tp obj) { void set(Tp&& obj) {
Dune::Hybrid::ifElse(std::is_same<Tp, Head_>(), using T = std::decay_t<Tp>;
[&](auto&& id) { head_=std::move(id(obj)); }, Dune::Hybrid::ifElse(std::is_same<T, Head_>(),
[&](auto&& id) { return id(tail_).set(std::move(obj)); } [&](auto&& id) { id(head_)=std::forward<Tp>(obj); },
[&](auto&& id) { return id(tail_).set(std::forward<Tp>(obj)); }
); );
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment