William McPherson
d7177212fd
AK: Add a BinarySearch template implementation
...
binary_search takes a haystack, a size, a needle and a compare function.
The compare function should return negative if a < b, positive if a > b
and 0 if a == b. The "sane default" compare function is integral_compare
which implements this with subtraction a - b.
binary_search returns a pointer to a matching element, NOT necessarily
the FIRST matching element. It returns a nullptr if the element was not
found.
This patch includes tests for binary_search.
2019-12-02 15:30:45 +01:00
..
2019-12-02 15:30:45 +01:00
2019-11-06 13:58:08 +01:00
2019-11-16 12:18:25 +01:00
2019-06-11 23:47:51 -07:00
2019-12-02 15:30:45 +01:00
2019-10-01 19:58:07 +02:00
2019-12-02 09:19:56 +01:00
2019-09-30 08:57:01 +02:00
2019-10-23 12:27:43 +02:00
2019-10-23 12:27:43 +02:00
2019-11-29 14:59:15 +01:00
2019-06-29 19:14:03 +02:00
2019-07-31 09:06:39 +02:00
2019-08-23 19:58:16 +02:00
2019-09-06 15:36:54 +02:00
2019-08-07 20:05:36 +02:00
2019-05-28 17:31:20 +02:00
2019-07-03 21:20:13 +02:00
2019-08-25 06:45:27 +02:00
2019-08-25 17:47:48 +02:00
2019-08-08 13:39:40 +02:00
2019-08-17 11:25:32 +02:00
2019-09-06 15:36:54 +02:00
2019-06-07 17:14:16 +02:00
2019-10-23 14:55:21 +02:00
2019-09-04 14:40:11 +02:00
2019-10-29 16:36:50 +01:00
2019-09-04 14:40:11 +02:00
2019-08-14 15:01:42 +02:00
2019-08-04 20:23:46 +02:00
2019-10-29 16:36:50 +01:00
2019-10-29 16:36:50 +01:00
2019-09-16 09:01:44 +02:00
2019-07-21 21:43:37 +02:00
2019-11-06 11:37:03 +01:00
2019-11-06 11:37:03 +01:00
2019-09-06 15:36:54 +02:00
2019-09-30 08:57:01 +02:00
2019-06-26 20:01:48 +02:00
2019-09-22 00:17:29 +02:00
2019-11-07 18:00:05 +01:00
2019-07-25 11:10:28 +02:00
2019-08-19 19:04:52 +02:00
2019-11-07 18:00:05 +01:00
2019-07-25 11:10:28 +02:00
2019-08-25 06:45:09 +02:00
2019-08-14 21:21:15 +02:00
2019-07-25 14:25:45 +02:00
2019-11-04 20:48:30 +01:00
2019-11-03 12:33:51 +01:00
2019-06-07 11:46:02 +02:00
2019-06-21 18:58:45 +02:00
2019-08-14 11:47:38 +02:00
2019-07-31 09:06:39 +02:00
2019-07-25 15:21:16 +02:00
2019-06-18 09:31:14 +02:00
2019-07-08 14:06:22 +02:00
2019-07-29 11:58:44 +02:00
2019-10-28 19:08:48 +01:00
2019-10-28 19:08:48 +01:00
2019-09-30 08:57:01 +02:00
2019-09-29 16:20:09 +02:00
2019-09-13 14:37:25 +02:00
2019-09-13 14:37:25 +02:00
2019-12-02 13:52:42 +01:00
2019-12-02 13:52:42 +01:00
2019-05-28 17:31:20 +02:00
2019-11-06 11:37:03 +01:00
2019-06-06 18:02:28 +02:00
2019-08-14 11:47:38 +02:00
2019-09-07 15:39:26 +02:00
2019-11-25 21:21:27 +01:00
2019-11-25 21:21:27 +01:00
2019-10-18 22:49:23 +02:00
2019-10-18 22:49:23 +02:00
2019-11-07 20:38:33 +01:00
2019-06-21 18:58:45 +02:00
2019-11-15 16:07:39 +01:00