0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-29 20:28:52 +02:00

ircd::util: Improve some comments; minor cleanup.

This commit is contained in:
Jason Volk 2020-05-28 15:17:05 -07:00
parent d9f8e0d0ab
commit 7064e4f349
2 changed files with 8 additions and 4 deletions

View file

@ -15,11 +15,12 @@ namespace ircd {
inline namespace util inline namespace util
{ {
template<class T> struct scope_count; template<class T> struct scope_count;
}}; }}
/// A simple boiler-plate for incrementing a counter when constructed and /// Increment a counter when constructed and decrement it when destructed.
/// decrementing it to its previous value when destructed. This takes a runtime /// This takes a runtime reference to that counter. The counter thus maintains
/// reference to that counter. /// the number of reentrances (or entrances across different contexts).
///
template<class T> template<class T>
struct ircd::util::scope_count struct ircd::util::scope_count
{ {

View file

@ -17,6 +17,9 @@ inline namespace util
template<class T> struct scope_restore; template<class T> struct scope_restore;
}} }}
/// Overwrite a value for the duration of the instance restoring the
/// original value at destruction. Device cannot be moved or copied.
///
template<class T> template<class T>
struct ircd::util::scope_restore struct ircd::util::scope_restore
{ {