forked from nothke/intro-to-zig-talk
Initial
This commit is contained in:
27
c/raii.cpp
Normal file
27
c/raii.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
class MyClass
|
||||
{
|
||||
public:
|
||||
void* ptr;
|
||||
|
||||
MyClass()
|
||||
{
|
||||
ptr = malloc(sizeof(100000000));
|
||||
}
|
||||
|
||||
~MyClass()
|
||||
{
|
||||
free(ptr);
|
||||
}
|
||||
};
|
||||
|
||||
MyClass myClass;
|
||||
|
||||
int main()
|
||||
{
|
||||
std::vector<MyClass> vec;
|
||||
vec.push_back({});
|
||||
|
||||
}
|
Reference in New Issue
Block a user