Why std::unique_ptr is not compatible with assignement operator?
For example:-
std::unique_ptr<int> int_ptr=new int(10); // error: conversion from ‘int*’ to non-scalar type ‘std::unique_ptr’ requested.
std::unique_ptr<int> pointer(new int(10)); // this work fine.
Aucun commentaire:
Enregistrer un commentaire