From bab021a6203127f38fb89c61cc41deb3e0abbe62 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 17 Mar 2020 07:33:41 +0200 Subject: Add $defined() function --- libbuild2/function.hxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'libbuild2/function.hxx') diff --git a/libbuild2/function.hxx b/libbuild2/function.hxx index ce47bd9..b745173 100644 --- a/libbuild2/function.hxx +++ b/libbuild2/function.hxx @@ -32,7 +32,7 @@ namespace build2 // as arguments. There is also higher-level, more convenient support for // defining functions as pointers to functions (including capture-less // lambdas), pointers to member functions (e.g., string::size()), or - // pointers to data members (e.g., name::type). In this case the build2 + // pointers to data members (e.g., name::type). In this case the buildfile // function types are automatically matched to C++ function types according // to these rules: // @@ -43,6 +43,15 @@ namespace build2 // value* - NULL-able any type (never NULL itself, use value::null) // optional - optional argument (here T can be T*, names, value) // + // The overload resolution is pretty simple: we sort all the candidates into + // three ranks: + // + // 0 -- all the arguments match exactly (perfect match) + // 1 -- one or more arguments match via the derived-to-base conversion + // 2 -- one or more arguments match via the reversal to untyped + // + // More than one match of the same rank is ambiguous. + // // Optional arguments must be last. In case of a failure the function is // expected to issue diagnostics and throw failed. Note that the arguments // are conceptually "moved" and can be reused by the implementation. -- cgit v1.1