mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-05 09:20:29 +00:00
Don't require including std::string
Also runs the test file through clang-format.
This commit is contained in:
parent
cd5e646b74
commit
8d4158571d
1 changed files with 6 additions and 4 deletions
|
@ -18,12 +18,13 @@
|
||||||
|
|
||||||
#include "ctl/string.h"
|
#include "ctl/string.h"
|
||||||
|
|
||||||
|
#include <__type_traits/is_same.h>
|
||||||
#include <__utility/move.h>
|
#include <__utility/move.h>
|
||||||
|
|
||||||
#include "libc/runtime/runtime.h"
|
#include "libc/runtime/runtime.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
|
||||||
#include <string>
|
// #include <string>
|
||||||
// #define ctl std
|
// #define ctl std
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -312,7 +313,7 @@ main()
|
||||||
s.append(" world");
|
s.append(" world");
|
||||||
}
|
}
|
||||||
if (s != "hello world world world world world world world world world "
|
if (s != "hello world world world world world world world world world "
|
||||||
"world world") {
|
"world world") {
|
||||||
return 64;
|
return 64;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -355,9 +356,10 @@ main()
|
||||||
|
|
||||||
{
|
{
|
||||||
ctl::string s;
|
ctl::string s;
|
||||||
if constexpr (!std::is_same_v<ctl::string, std::string>) {
|
#undef ctl
|
||||||
|
if constexpr (std::is_same_v<ctl::string, decltype(s)>) {
|
||||||
// tests the small-string optimization on ctl::string
|
// tests the small-string optimization on ctl::string
|
||||||
char *d = s.data();
|
char* d = s.data();
|
||||||
for (int i = 0; i < 23; ++i) {
|
for (int i = 0; i < 23; ++i) {
|
||||||
s.append('a');
|
s.append('a');
|
||||||
if (s.data() != d) {
|
if (s.data() != d) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue