mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 09:46:52 -05:00
serialize: specify type for ParamsWrapper not ref
This commit is contained in:
parent
bf147bfffa
commit
33203f59b4
1 changed files with 3 additions and 4 deletions
|
@ -1161,12 +1161,11 @@ public:
|
||||||
template <typename Params, typename T>
|
template <typename Params, typename T>
|
||||||
class ParamsWrapper
|
class ParamsWrapper
|
||||||
{
|
{
|
||||||
static_assert(std::is_lvalue_reference<T>::value, "ParamsWrapper needs an lvalue reference type T");
|
|
||||||
const Params& m_params;
|
const Params& m_params;
|
||||||
T m_object;
|
T& m_object;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ParamsWrapper(const Params& params, T obj) : m_params{params}, m_object{obj} {}
|
explicit ParamsWrapper(const Params& params, T& obj) : m_params{params}, m_object{obj} {}
|
||||||
|
|
||||||
template <typename Stream>
|
template <typename Stream>
|
||||||
void Serialize(Stream& s) const
|
void Serialize(Stream& s) const
|
||||||
|
@ -1190,7 +1189,7 @@ public:
|
||||||
template <typename Params, typename T>
|
template <typename Params, typename T>
|
||||||
static auto WithParams(const Params& params, T&& t)
|
static auto WithParams(const Params& params, T&& t)
|
||||||
{
|
{
|
||||||
return ParamsWrapper<Params, T&>{params, t};
|
return ParamsWrapper<Params, T>{params, t};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // BITCOIN_SERIALIZE_H
|
#endif // BITCOIN_SERIALIZE_H
|
||||||
|
|
Loading…
Add table
Reference in a new issue