0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-10-04 14:48:56 +02:00

ircd: Add commentary to life_guard.

This commit is contained in:
Jason Volk 2017-08-25 13:21:52 -07:00
parent c43c8f83d3
commit e567293dde

View file

@ -22,6 +22,15 @@
#pragma once
#define HAVE_IRCD_LIFE_GUARD_H
//
// life_guard is a convenience which takes advantage of
// std::enable_shared_from_this<T>. The life_guard glorifies the constructor
// of an std::shared_ptr<T> by accepting std::weak_ptr<T> and T& itself all
// with proper semantics. Once construction is successful, the user holds it
// for the duration of the scope ensuring T& survives context interleaving
// without being destructed.
//
namespace ircd {
// Tests if type inherits from std::enable_shared_from_this<>