Namespaces
Variants
Views
Actions

std::breakpoint_if_debugging

From cppreference.com
< cpp‎ | utility
 
 
Utilities library
Language support
Type support (basic types, RTTI)
Library feature-test macros (C++20)
Dynamic memory management
Program utilities
Coroutine support (C++20)
Variadic functions
Debugging support
breakpoint_if_debugging
(C++26)
(C++26)
Three-way comparison
(C++20)
(C++20)(C++20)(C++20)
(C++20)(C++20)(C++20)
General utilities
Date and time
Function objects
Formatting library (C++20)
(C++11)
Relational operators (deprecated in C++20)
Integer comparison functions
(C++20)(C++20)(C++20)   
(C++20)
Swap and type operations
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
Common vocabulary types
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)
(C++23)
Elementary string conversions
(C++17)
(C++17)

 
Defined in header <debugging>
void breakpoint_if_debugging() noexcept;
(since C++26)

Conditional breakpoint: attempts to temporarily halt the execution of the program and transfer control to the debugger if it were able to determine that the debugger is present. Acts as a no-op otherwise.

Formally, the behavior of this function is completely implementation-defined. Equivalent to if (std::is_debugger_present())
    std::breakpoint();
.

[edit] Notes

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

[edit] See also

checks whether a program is running under the control of a debugger
(function) [edit]
pauses the running program when called
(function) [edit]