1
0
forked from Alepha/Alepha

Add a simple commandline parser example.

Also cleaned up a few files.  Since these were pulled from various
scratch repos from informal ISO discussions over the years, they don't
quite line up.  This at least gets everything building again.
This commit is contained in:
2023-10-10 02:24:58 -04:00
parent 83f693de53
commit 76606fca97
15 changed files with 352 additions and 146 deletions

View File

@ -79,6 +79,26 @@ namespace Alepha::Hydrogen
decltype( auto ) operator->() const { return value; }
};
template< typename Dtor >
class AutoRAII< void, Dtor > : boost::noncopyable
{
private:
Dtor dtor;
public:
~AutoRAII()
{
if constexpr( std::is_same_v< Dtor, std::function< void () > > )
{
if( dtor == nullptr ) return;
}
dtor();
}
template< typename Ctor >
explicit AutoRAII( Ctor ctor, Dtor dtor ) : dtor( std::move( dtor ) ) { ctor(); }
};
template< typename Ctor, typename Dtor >
explicit AutoRAII( Ctor ctor, Dtor ) -> AutoRAII< decltype( ctor() ), Dtor >;
}