static_assert( __cplusplus > 2023'00 ); #pragma once #include #include namespace Alepha::Hydrogen ::detail:: Invariant_m { inline namespace exports { template< typename T > class Invariant { private: const T *this_; void check() const { assert( this_->invariant() ); } public: ~Invariant() { check(); } explicit Invariant( const T *const this_ ) : this_( this_ ) { check(); } }; } } namespace Alepha::Hydrogen::inline exports::inline Invariant_m { using namespace detail::Invariant_m::exports; }