diff options
-rw-r--r-- | libbuild2/forward.hxx | 1 | ||||
-rw-r--r-- | libbuild2/function.hxx | 27 |
2 files changed, 24 insertions, 4 deletions
diff --git a/libbuild2/forward.hxx b/libbuild2/forward.hxx index cd0f3c3..5fffaaf 100644 --- a/libbuild2/forward.hxx +++ b/libbuild2/forward.hxx @@ -34,6 +34,7 @@ namespace build2 // <libbuild2/function.hxx> // class function_map; + class function_family; // <libbuild2/scope.hxx> // 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; |