| ▲ | einpoklum 4 hours ago | |||||||
> There's a single "I guess I would use this" container type, std::vector. About that one... I would claim that in a majority of cases where an std::vector is used, what the author really wanted was a similar type, but whose size and capacity are fixed on construction and never change. The standard C++ library does not offer such a type - so people use vector because it's handy. Agree with your takes on most of the containers. I also dislike how optionals are never used with containers as they were standardized later (and even then, problematically w.r.t. references). Thus, for example, if I lookup an object in a map of T's, the result should IMNSHO be an optional reference to a T. | ||||||||
| ▲ | Joker_vD 2 hours ago | parent | next [-] | |||||||
> a similar type, but whose size and capacity are fixed on construction and never change. There is std::array for that. Also, for a type with fixed capacity but variable (up to that capacity) size, we're getting std::inplace_vector soon™. | ||||||||
| ||||||||
| ▲ | afdbcreid 4 hours ago | parent | prev [-] | |||||||
What operations could such frozen vector offer that std::vector does not? If there are none, it doesn't need a separate data structure. | ||||||||
| ||||||||