MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / BuildScript

Function BuildScript

src/script/script.h:611–632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

609/** Build a script by concatenating other scripts, or any argument accepted by CScript::operator<<. */
610template<typename... Ts>
611CScript BuildScript(Ts&&... inputs)
612{
613 CScript ret;
614 int cnt{0};
615
616 ([&ret, &cnt] (Ts&& input) {
617 if constexpr (std::is_same_v<std::remove_cv_t<std::remove_reference_t<Ts>>, CScript>) {
618 // If it is a CScript, extend ret with it. Move or copy the first element instead.
619 if (cnt == 0) {
620 ret = std::forward<Ts>(input);
621 } else {
622 ret.insert(ret.end(), input.begin(), input.end());
623 }
624 } else {
625 // Otherwise invoke CScript::operator<<.
626 ret << input;
627 }
628 cnt++;
629 } (std::forward<Ts>(inputs)), ...);
630
631 return ret;
632}
633
634#endif // BITCOIN_SCRIPT_SCRIPT_H

Callers 5

ScriptSizeMethod · 0.85
ScriptSizeMethod · 0.85
ToScriptMethod · 0.85
ParseFunction · 0.85
ComputeScriptLenFunction · 0.85

Calls 3

insertMethod · 0.45
endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected