mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 22:02:27 +00:00
Introduce more CTL content
This change introduces accumulate, addressof, advance, all_of, distance, array, enable_if, allocator_traits, back_inserter, bad_alloc, is_signed, any_of, copy, exception, fill, fill_n, is_same, is_same_v, out_of_range, lexicographical_compare, is_integral, uninitialized_fill_n, is_unsigned, numeric_limits, uninitialized_fill, iterator_traits, move_backward, min, max, iterator_tag, move_iterator, reverse_iterator, uninitialized_move_n This change experiments with rewriting the ctl::vector class to make the CTL design more similar to the STL. So far it has not slowed things down to have 42 #include lines rather than 2, since it's still almost nothing compared to LLVM's code. In fact the closer we can flirt with being just like libcxx, the better chance we might have of discovering exactly what makes it so slow to compile. It would be an enormous discovery if we can find one simple trick to solving the issue there instead. This also fixes a bug in `ctl::string(const string &s)` when `s` is big.
This commit is contained in:
parent
054da021d0
commit
38921dc46b
52 changed files with 2980 additions and 193 deletions
|
@ -17,10 +17,9 @@
|
|||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
#include "ctl/string.h"
|
||||
#include "ctl/type_traits.h"
|
||||
#include "libc/mem/leaks.h"
|
||||
|
||||
#include <__type_traits/is_same.h>
|
||||
|
||||
#include "libc/str/str.h"
|
||||
|
||||
// #include <string>
|
||||
|
@ -366,7 +365,7 @@ main()
|
|||
|
||||
{
|
||||
String s;
|
||||
if constexpr (std::is_same_v<ctl::string, decltype(s)>) {
|
||||
if constexpr (ctl::is_same_v<ctl::string, decltype(s)>) {
|
||||
// tests the small-string optimization on ctl::string
|
||||
for (int i = 0; i < 23; ++i) {
|
||||
s.append("a");
|
||||
|
@ -397,7 +396,7 @@ main()
|
|||
s.resize(4);
|
||||
if (s != "arst")
|
||||
return 105;
|
||||
if constexpr (std::is_same_v<ctl::string, decltype(s)>) {
|
||||
if constexpr (ctl::is_same_v<ctl::string, decltype(s)>) {
|
||||
String r(s);
|
||||
if (issmall(s) || !issmall(r))
|
||||
return 106;
|
||||
|
@ -405,5 +404,4 @@ main()
|
|||
}
|
||||
|
||||
CheckForMemoryLeaks();
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue