mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-01 00:38:31 +00:00
Add more CTL content
This commit is contained in:
parent
38921dc46b
commit
021c53ba32
56 changed files with 1747 additions and 298 deletions
|
@ -16,7 +16,7 @@
|
|||
// TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
#include "ctl/type_traits.h"
|
||||
#include "ctl/is_same.h"
|
||||
#include "ctl/unique_ptr.h"
|
||||
#include "libc/mem/leaks.h"
|
||||
|
||||
|
@ -41,29 +41,30 @@ MkRaw()
|
|||
return ctl::make_unique_for_overwrite<T>();
|
||||
}
|
||||
|
||||
#undef ctl
|
||||
// #undef ctl
|
||||
|
||||
static int g = 0;
|
||||
|
||||
struct SetsGDeleter
|
||||
{
|
||||
void operator()(auto*) const noexcept
|
||||
void operator()(auto* x) const noexcept
|
||||
{
|
||||
++g;
|
||||
delete x;
|
||||
}
|
||||
};
|
||||
|
||||
struct StatefulDeleter
|
||||
{
|
||||
char state;
|
||||
void operator()(auto*) const noexcept
|
||||
void operator()(auto* x) const noexcept
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct FinalDeleter final
|
||||
{
|
||||
void operator()(auto*) const noexcept
|
||||
void operator()(auto* x) const noexcept
|
||||
{
|
||||
}
|
||||
};
|
||||
|
@ -99,6 +100,7 @@ struct Derived : Base
|
|||
int
|
||||
main()
|
||||
{
|
||||
|
||||
{
|
||||
Ptr<int> x(new int(5));
|
||||
}
|
||||
|
@ -186,9 +188,9 @@ main()
|
|||
g = 0;
|
||||
{
|
||||
auto x = Mk<SetsGDtor>();
|
||||
x.release();
|
||||
delete x.release();
|
||||
}
|
||||
if (g)
|
||||
if (g != 1)
|
||||
return 13;
|
||||
}
|
||||
|
||||
|
@ -224,8 +226,5 @@ main()
|
|||
Ptr<Base> z(ctl::move(y));
|
||||
}
|
||||
|
||||
// next is 18
|
||||
|
||||
// TODO(mrdomino): Fix memory leaks reported by MODE=dbg
|
||||
// CheckForMemoryLeaks();
|
||||
CheckForMemoryLeaks();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue