Longhanks / cpp-defer

defer statement for C++

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cpp-defer

Single header library defer statement for C++. Adapted from LLVM and the Swift compiler.

Copyright / License

The project consists of the contents of llvm/include/llvm/ADT/ScopeExit.h and swift/Basic/Defer.h. Both were retrieved on the 11th of September 2019 and were available under the following licenses:

ScopeExit.h

Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions
See https://llvm.org/LICENSE.txt for license information
Defer.h

Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
Licensed under Apache License v2.0 with Runtime Library Exception

See https://swift.org/LICENSE.txt for license information
See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

Thus, this project is also available under the Apache License v2.0 with the Runtime Library Exception. For more information, see LICENSE-llvm.txt and LICENSE-swift.txt.

Usage

See defer.h.

defer {
    const char s[] = "At exit\n";
    printf("%s", s);
};

About

defer statement for C++

License:Apache License 2.0


Languages

Language:C++ 100.0%