constスマートポインタ
constなポインタは初心者がよく戸惑う文法だが、私は最近スマートポインタで戸惑ったorz
以下、対応表
const int* pRaw; std::shared_ptr< const int > pSmart; //↑ポインタの中身がconst。ポインタ自体は書き換えられる。 int* const pRaw; const std::shared_ptr< int > pSmart; //↑ポインタ自体がconst。中身は書き換えられる。 const int* const pRaw; const std::shared_ptr< const int > pSmart; //↑ポインタ自体も中身もconst
簡単なテストしかしていないから間違っているかも(ぉ