Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
scoped_refptr<any_class> a_scoped_refptr; const scoped_refptr<any_class> something = a_scoped_refptr; // Compile error.
const の場合は ref_counter を変更できませんが、ポインターが指すコンテンツを変更してはならないことを暗示したいのですが、どうすればよいですか?
2つのこと:
最初に、コンパイラ エラーについて言及していませんでしたが、scoped_refptr.
scoped_refptr
次に、const オブジェクトへのポインターが必要な場合は、それをポインター型として指定します。だから試してください:
scoped_refptr<any_class const> myPointer = a_scoped_refptr;