私にはあまり意味のないコンパイラ エラーが発生しました。
#include <memory>
using namespace std;
auto_ptr<Table> table = db->query("select * from t");
エラー: 'Table*' から非スカラー型 'std::auto_ptr< Table>' への変換が要求されました
ただし、次の行は機能します。
auto_ptr<Table> table(db->query("select * from t"));
コンストラクターのこの定義について、期待どおりに動作しないのは何ですか? 初期化された宣言はコンストラクターを使用していると思いました。
これが私auto_ptr
のコンストラクタです(SGI STLから):
explicit
auto_ptr(element_type* __p = 0) throw() : _M_ptr(__p) { }