serialize: specify type for ParamsWrapper not ref

pull/28473/head
Anthony Towns 1 year ago
parent bf147bfffa
commit 33203f59b4

@ -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…
Cancel
Save