mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-24 06:12:27 +00:00
CTL: utility.h, use ctl::swap in string (#1227)
* Add ctl utility.h Implements forward, move, swap, and declval. This commit also adds a def for nullptr_t to cxx.inc. We need it now because the CTL headers stopped including anything from libc++, so we no longer get their basic types. * Use ctl::swap in string The STL spec says that swap is located in the string_view header anyawy. Performance-wise this is a noop, but it’s slightly cleaner.
This commit is contained in:
parent
a795017416
commit
9a5a13854d
13 changed files with 117 additions and 46 deletions
|
@ -63,7 +63,7 @@ main()
|
|||
|
||||
{
|
||||
ctl::optional<ctl::string> x("world");
|
||||
ctl::optional<ctl::string> y(std::move(x));
|
||||
ctl::optional<ctl::string> y(ctl::move(x));
|
||||
if (!y)
|
||||
return 9;
|
||||
if (!y.has_value())
|
||||
|
@ -87,7 +87,7 @@ main()
|
|||
{
|
||||
ctl::optional<ctl::string> x("hello");
|
||||
ctl::optional<ctl::string> y;
|
||||
y = std::move(x);
|
||||
y = ctl::move(x);
|
||||
if (!y)
|
||||
return 16;
|
||||
if (!y.has_value())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue