Helper similar to std::unique_lock for detecting when calculations such as has_special have entered infinite recursion. More...
#include <attack_type.hpp>
Public Member Functions | |
recursion_guard () | |
Construct an empty instance, only useful for extending the lifetime of a recursion_guard returned from weapon.update_variables_recursion() by std::moving it to an instance declared in a larger scope. More... | |
operator bool () const | |
Returns true if a level of recursion was available at the time when update_variables_recursion() created this object. More... | |
recursion_guard (recursion_guard &&other) | |
recursion_guard (const recursion_guard &other)=delete | |
recursion_guard & | operator= (recursion_guard &&) |
recursion_guard & | operator= (const recursion_guard &)=delete |
~recursion_guard () | |
Private Member Functions | |
recursion_guard (const attack_type &weapon, const config &special) | |
Only expected to be called in update_variables_recursion(), which handles some of the checks. More... | |
Private Attributes | |
std::shared_ptr< const attack_type > | parent |
Friends | |
class | attack_type |
Helper similar to std::unique_lock for detecting when calculations such as has_special have entered infinite recursion.
This assumes that there's only a single thread accessing the attack_type, it's a lightweight increment/decrement counter rather than a mutex.
Definition at line 183 of file attack_type.hpp.
|
explicitprivate |
Only expected to be called in update_variables_recursion(), which handles some of the checks.
Definition at line 684 of file attack_type.cpp.
References parent.
|
explicitdefault |
Construct an empty instance, only useful for extending the lifetime of a recursion_guard returned from weapon.update_variables_recursion() by std::moving it to an instance declared in a larger scope.
attack_type::recursion_guard::recursion_guard | ( | attack_type::recursion_guard && | other | ) |
Definition at line 690 of file attack_type.cpp.
References swap().
|
delete |
attack_type::recursion_guard::~recursion_guard | ( | ) |
Definition at line 710 of file attack_type.cpp.
attack_type::recursion_guard::operator bool | ( | ) | const |
Returns true if a level of recursion was available at the time when update_variables_recursion() created this object.
Definition at line 695 of file attack_type.cpp.
|
delete |
attack_type::recursion_guard & attack_type::recursion_guard::operator= | ( | attack_type::recursion_guard && | other | ) |
Definition at line 699 of file attack_type.cpp.
References swap().
|
friend |
Definition at line 184 of file attack_type.hpp.
|
private |
Definition at line 209 of file attack_type.hpp.
Referenced by recursion_guard().