aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/functions-builtin.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-11-03 13:08:48 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-11-04 08:09:42 +0200
commit10e634e64b5fffaf19778d8fd3aa854118aa0d53 (patch)
tree99d09d1ae6a7024b7dbc6c436bf1bc780640fe16 /libbuild2/functions-builtin.cxx
parente612a49ef95cf9ce3d0b5496d724f73cae9aa333 (diff)
Add $size() function to get size of sequence (names, strings, etc)
Diffstat (limited to 'libbuild2/functions-builtin.cxx')
-rw-r--r--libbuild2/functions-builtin.cxx21
1 files changed, 4 insertions, 17 deletions
diff --git a/libbuild2/functions-builtin.cxx b/libbuild2/functions-builtin.cxx
index d040ba8..c013c3b 100644
--- a/libbuild2/functions-builtin.cxx
+++ b/libbuild2/functions-builtin.cxx
@@ -100,25 +100,12 @@ namespace build2
return os.str ();
};
- // $sort(<names> [, <flags>])
+ // $size(<ints>)
//
- // Sort names in ascending order.
+ // Return the number of elements in the sequence.
//
- // See also type-specific overloads.
- //
- // The following flags are supported:
- //
- // dedup - in addition to sorting also remove duplicates
- //
- f["sort"] += [] (names v, optional<names> fs)
- {
- sort (v.begin (), v.end ());
-
- if (functions_sort_flags (move (fs)))
- v.erase (unique (v.begin(), v.end()), v.end ());
-
- return v;
- };
+ f["size"] += [] (int64s v) {return v.size ();};
+ f["size"] += [] (uint64s v) {return v.size ();};
// $sort(<ints> [, <flags>])
//