diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-11-11 15:04:27 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-11-11 15:04:27 +0200 |
commit | 011adfe1efe3ff20dc019e242d56c95b2b35ac13 (patch) | |
tree | 1449476328b74fb98884a9dc22766836ac8dedd3 /libbuild2/function.hxx | |
parent | 1b80ce6765eb555f6e9dfcfa995415811640d4be (diff) |
Expose low-level function registration support
Diffstat (limited to 'libbuild2/function.hxx')
-rw-r--r-- | libbuild2/function.hxx | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/libbuild2/function.hxx b/libbuild2/function.hxx index 47eee5b..43b8024 100644 --- a/libbuild2/function.hxx +++ b/libbuild2/function.hxx @@ -249,10 +249,9 @@ namespace build2 default_thunk (const scope*, vector_view<value>, const function_overload&); // A function family uses a common qualification (though you can pass - // empty string to supress it). For an unqualified name (doesn't not - // contain a dot) the qualified version is added automatically. A name - // containing a leading dot is a shortcut notation for a qualified-only - // name. + // empty string to supress it). For an unqualified name (doesn't contain + // dot) the qualified version is added automatically. A name containing a + // leading dot is a shortcut notation for a qualified-only name. // function_family (function_map& map, string qual, @@ -910,6 +909,26 @@ namespace build2 typename cast::data {&cast::thunk, dm})); } + // Low-level interface that can be used to register additional data. + // + // Note that the call to this function sidesteps the thunk. + // + template <typename D, typename... A> + void + insert (function_impl* i, D d) && + { + using args = function_args<A...>; + + insert (move (name), + function_overload ( + nullptr, + args::min, + args::max, + function_overload::types (args::types, args::max), + i, + move (d))); + } + private: void insert (string, function_overload) const; |