I have a POD I use as a unique_ptr and lldb tells me its of type POD *. I have a free floating function I'd like to pass a reference of this POD to so I can populate public properties.
If I add a parameter of type POD * to the function, Clang has no problems compiling my code but if I try to pass unique_ptr<POD> ¶m or unique_ptr<POD param it fails with:
Candidate function not viable: no known conversion from ' *' to 'unique_ptr<>'
I thought I could always pass a unique_ptr where I'd have a raw pointer and vice-versa?
Update, method signature:
Original:
void connection_fsm(const LogLevel &level, const bytes &barray, unique_ptr<PGOutput> &output) noexcept;
vs
void connection_fsm(const LogLevel &level, const bytes &barray, unique_ptr<Conn> &conn, unique_ptr<PGOutput> &output) noexcept;
vs
void connection_fsm(const LogLevel &level, const bytes &barray, unique_ptr<Conn> conn, unique_ptr<PGOutput> &output) noexcept;
vs
void connection_fsm(const LogLevel &level, const bytes &barray, Conn *conn, unique_ptr<PGOutput> &output) noexcept;
Aucun commentaire:
Enregistrer un commentaire