Running a lambda on scope exit seems like such a basic thing, I would expect it to be standardized. Things like unique_ptr are better, when they apply, but I find there is an endless supply of "one-off" destructors are needed, especially when leveraging C-style libraries. Does anyone know if this is coming?
Will there be standardization of scope guard/scope exit idioms?
3.7k views Asked by VoidStar At
2
There are 2 answers
3
Nicol Bolas
On
It would appear that the current version of the scope exit paper, P0052, will be going into the Library Fundamentals v3, for likely adoption in the Post-C++17 standard.
In short, not gonna happen for C++17. Sorry.
Related Questions in C++
- How to immediately apply DISPLAYCONFIG_SCALING display scaling mode with SetDisplayConfig and DISPLAYCONFIG_PATH_TARGET_INFO
- Why can't I use templates members in its specialization?
- How to fix "Access violation executing location" when using GLFW and GLAD
- Dynamic array of structures in C++/ cannot fill a dynamic array of doubles in structure from dynamic array of structures
- How do I apply the interface concept with the base-class in design?
- File refuses to compile std::erase() even if using -std=g++23
- How can I do a successful map when the number of elements to be mapped is not consistent in Thrust C++
- Can std::bit_cast be applied to an empty object?
- Unexpected inter-thread happens-before relationships from relaxed memory ordering
- How i can move element of dynamic vector in argument of function push_back for dynamic vector
- Brick Breaker Ball Bounce
- Thread-safe lock-free min where both operands can change c++
- Watchdog Timer Reset on ESP32 using Webservers
- How to solve compiler error: no matching function for call to 'dmhFS::dmhFS()' in my case?
- Conda CMAKE CXX Compiler error while compiling Pytorch
Related Questions in C++14
- Why can't I use templates members in its specialization?
- Is there a way to implement std::regular_invocable as a type_trait style function in c++11/c++14?
- The instruction at 0x00007FF697F8AE43 referenced memory at OxFFFFFFFFFFFFFFFF. The memory could not be read
- operator delete after both operator new and placement new?
- module "QtNetwork" is not installed
- How can std::unique_ptr apply EBO on closure?
- auto in if clause - the way to define parameters inside if
- How to undefine and redefine a macro in C++?
- how to overload unique_ptr in a class . i am getting compilation error
- C++ Fundamentals: Template operator- overloading Failed - "template argument deduction/substitution failed"
- How to handle char and string in variable?
- Class A declares Class B as a friend, but Class B has Class A as a member
- How to write a google mock matcher to match a void pointer argument?
- Pre-C++17 replacement for CTAD?
- C++ constexpr compiles too fast
Related Questions in C++17
- How to convert mathematical expression to lambda function in C++?
- How can I include a file using Eigen's plugin include?
- What was the problem with std::is_callable?
- Using lambda function in constexpr constructor with std::tie
- How to build new types by expand a parameter pack together with another list of types?
- Solved: Create standalone executable for MacOS with OpenCV and libmagic
- C++ File Input Skipping Lines
- C++: initialization of auto&& with the ternary operator leads to the copy constructor call on MSVC
- Correctly copying temporary string from a string_view (C++ 17)
- This is not a question, but an interesting thing I discovered yesterday in visual studio c++ 17 compiler
- How can std::unique_ptr apply EBO on closure?
- Is the ordering of std::recursive_directory_iterator specified?
- Initialize a logger once
- Listing all files in the directories and subdirectories recursively in c++
- Why does the C++17 standard not allow converting a string to a bool?
Related Questions in SCOPEGUARD
- C++ scope guard with zero overhead
- Performance of golang style defer scope guard in C++
- Is a lambda-expression that only captures by reference guaranteed not to throw?
- Is there any way to extend the lifetime of a temporary object in C++?
- How to avoid warning when using scope guard?
- C++ : other one simple scope guard
- C++: why this simple Scope Guard works?
- Will there be standardization of scope guard/scope exit idioms?
- Difference between ScopeGuard11 and Boost.ScopeExit - just backwards compatibility?
- ScopeGuard usage with multiple resourace allocatons and exit points in a fucntion
- Using std::unique_ptr and lambdas to advance a state of an object
- Life extension of temporary by const reference
- Who copies the return value of a function?
- Why can't Alexandrescu use std::uncaught_exception() to implement SCOPE_FAIL in ScopeGuard11?
- RAII wrapper for function pairs and template specialization
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
n4189 is a proposal to add
make_scope_exitwrappers, and other similar resource handlers, to the language. It is based off of the relatively famousscope_guardtalk.The most recent "current paper status" from LWG is in 2013, prior to the above date.
The contents of C++1z (hopefully C++17) are yet to be determined.
C++1z status for clang does not mention it. C++1z TS for clang does not mention it.
The paper itself contains an example implementation. I do not know what licensing terms it is under.