std::is_debugger_present
From cppreference.com
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Diagnostics library
(until C++20*)
(C++17)(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
Exception handling failures
(C++11)
(until C++17*)
(until C++17*)
(until C++17*)
(until C++17*)
(TM TS)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++23)
(C++23)
is_debugger_present
(C++26)
(C++26)
(C++26)
Defined in header
<debugging>
bool is_debugger_present() noexcept;
(since C++26)
Attempts to determine if the program is being executed with debugger present.
This function is replaceable.
[edit] Return value
The default version returns an implementation-defined value, which usually represents whether the program is executed under a debugger.
[edit] Notes
The intent of this function is allowing printing out extra output to help diagnose problems, executing extra test code, displaying an extra user interface to help in debugging, etc.
| Feature-test macro | Value | Std | Feature |
|---|---|---|---|
__cpp_lib_debugging |
202311L |
(C++26) | Debugging support library |
202403L |
(C++26) | Replaceable std::is_debugger_present
|
[edit] Example
This section is incomplete
Reason: no example
Reason: no example
[edit] See also
[edit] External links
is_debugger_present standardizes many similar existing facilities, e.g.:
1.
under_debugger from boost.test
2.
IsDebuggerPresent() from Win32 API
3.
isDebuggerActive from Catch2
4.
IsDebuggerPresent from Unreal Engine