Is it possible to write a deduction guide so that an instance of Simple can be declared without template arguments? I've tried but cannot get the correct form to extract the unique_ptr element type.
//------------------------------------------------------------------------------
template< class T >
class Simple
{
public:
Simple( std::unique_ptr< T >& u ) :
u_( u )
{}
private:
std::unique_ptr< T >& u_;
};
class MyThing
{};
int main()
{
std::unique_ptr< MyThing > upSimple;
Simple( upSimple ); // error C2955: 'Simple': use of class template requires template argument list
}
Aucun commentaire:
Enregistrer un commentaire