Skip to content
/ defer Public

Jai-like defer for C++

License

MIT, Unlicense licenses found

Licenses found

MIT
LICENSE
Unlicense
UNLICENSE
Notifications You must be signed in to change notification settings

LAK132/defer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Ever wanted to use RAII but didn't want to create a new struct/class every time?

Now you can!

#include <iostream>
#include <defer.hpp>

int main()
{
    // Single function calls can be encapsulated in a DEFER call
    DEFER(printf(", World!"));
    printf("Hello");
}
#include <iostream>
#include <string>
#include <defer.hpp>

int main()
{
    auto *str = new std::string("World!");
    // Blocks can also be encapsulated in a DEFER call
    DEFER({ delete str; printf("\n"); });
    printf("Hello, %s", str->c_str());
}

Dual licensed under MIT and The Unlicense

About

Jai-like defer for C++

Resources

License

MIT, Unlicense licenses found

Licenses found

MIT
LICENSE
Unlicense
UNLICENSE

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages