sipa / miniscript

Miniscript site and implementation
159 stars 47 forks source link

Modernize codebase: optional instead of out-args #109

Open sipa opened 2 years ago

sipa commented 2 years ago

The codebase in several places uses constructions like functions that return a bool to communicate success/failure, and then actually put their output in a by-ref argument, e.g.:

template<typename Ctx> bool ToString(const Ctx& ctx, std::string& ret) const

With the code now using C++17, I think those should be retrofitted to use std::optional instead:

template<typename Ctx> std::optional<std::string> ToString(const Ctx& ctx) const

(and many other examples)