use perfect forwarding to resolve copy/move semantics of universal references - #2651
This commit is contained in:
parent
c1f6b12d73
commit
a8443df1a1
1 changed files with 3 additions and 11 deletions
|
@ -48,19 +48,11 @@ struct value_holder : value_holder_base
|
||||||
value_holder()
|
value_holder()
|
||||||
: value_holder_base() {}
|
: value_holder_base() {}
|
||||||
|
|
||||||
// copy
|
// perfect forwarding
|
||||||
value_holder(const char* val)
|
|
||||||
: value_holder_base(val) {}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
value_holder(T const& obj)
|
|
||||||
: value_holder_base(typename detail::mapnik_value_type<T>::type(obj))
|
|
||||||
{}
|
|
||||||
|
|
||||||
// move
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
value_holder(T && obj) noexcept
|
value_holder(T && obj) noexcept
|
||||||
: value_holder_base(std::move(obj)) {}
|
: value_holder_base(std::forward<T>(obj))
|
||||||
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
using parameter = std::pair<std::string, value_holder>;
|
using parameter = std::pair<std::string, value_holder>;
|
||||||
|
|
Loading…
Reference in a new issue