動作しません
class A : public std::vector<int>
{
explicit A()
{
push_back(5);
std::cout << *this[0];
}
}
error: no match for 'operator*' (operand type is 'A')
std::cout << *this[0];'
ただし、に置き換える*this[0]とat(0)機能します。私はそれがそうであるように、型ではなく*this[0]型のオブジェクトを返すのは非常に奇妙だと思います。この例では、それらは同じように機能するはずではありませんか?Aintat(0)