зеркало из
https://github.com/iharh/notes.git
synced 2025-10-30 13:16:07 +02:00
23 строки
797 B
Plaintext
23 строки
797 B
Plaintext
https://github.com/martinmoene/martin-moene.blogspot.com/blob/master/Static%20polymorphic%20named%20parameters%20in%20C%2B%2B/curve.hpp
|
|
|
|
#if __cplusplus == 201103L
|
|
|
|
namespace std
|
|
{
|
|
template< class T, class... Args >
|
|
unique_ptr<T> make_unique( Args&&... args )
|
|
{
|
|
return unique_ptr<T>( new T( std::forward<Args>( args )... ) );
|
|
}
|
|
}
|
|
#endif
|
|
|
|
// crtp_cast:
|
|
|
|
template<class D, class B> D & crtp_cast(B & p) { return static_cast<D &>( p ); }
|
|
template<class D, class B> D const & crtp_cast(B const & p) { return static_cast<D const &>( p ); }
|
|
template<class D, class B> D volatile & crtp_cast(B volatile & p) { return static_cast<D volatile &>( p ); }
|
|
template<class D, class B> D const volatile & crtp_cast(B const volatile & p) { return static_cast<D const volatile &>( p ); }
|
|
|
|
|