の削除コンストラクタに呼び出す:打ち鳴らす++のエラーメッセージC++ 0xの使用:私は、バージョン4.2と打ち鳴らす++に私のXcodeをアップグレードしたこんにちは
Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin11.2.0
Thread model: posix
が試みが打ち鳴らすと、次のコードをコンパイルする-stdを= C++ 0xの
#include <memory>
#include <limits>
#include <boost/shared_ptr.hpp>
class ilpConstraintImpl {
public:
virtual ~ilpConstraintImpl() {}
};
class ilpConstraint {
public:
ilpConstraint(ilpConstraintImpl* implptr):impl(implptr) { }
public:
boost::shared_ptr<ilpConstraintImpl> impl;
};
class ilpExprImpl {
public:
virtual ilpConstraint operator<= (const double rs)=0;
virtual ~ilpExprImpl() {}
};
class ilpExpr {
public:
virtual ~ilpExpr() {};
ilpConstraint operator<= (const double rs) { return impl->operator<=(rs); }
ilpExpr(ilpExprImpl* implptr):impl(implptr) { }
boost::shared_ptr<ilpExprImpl> impl;
};
私は次のエラーを取得する:
./test.h:46:54: error: call to deleted constructor of 'ilpConstraint'
ilpConstraint operator<= (const double rs) { return impl->operator<=(rs); }
^~~~~~~~~~~~~~~~~~~~
./test.h:28:7: note: function has been explicitly marked deleted here
class ilpConstraint {
^
1 error generated.
は-std = C++ 0xの作品せずにコンパイル。
作品のそのようなもの...。 ) – plaisthos
申し訳ありません。 libC++から 'std :: shared_ptr'を試すことができます。 "C++標準ライブラリ"設定の下でlibC++を選択する必要があります(デフォルトではありません)。 –
私はboost_surrにコピーのコンストラクタが削除され、コピーを実行して優先されるコンストラクタのテンプレートに依存しているという問題があったことを覚えているようです。その後のバージョンでは、この問題が修正されました。 –