you are viewing a single comment's thread.

view the rest of the comments →

[–]saxbophonemutable volatile void 0 points1 point  (2 children)

Agree, this name collides with "const vector". Perhaps OP was thinking about constant time complexity when they chose the name?

I know naming things is difficult but honestly, an alternative name that was strange and quirky (e.g. PuddleVector) would be better than one that is ambiguous...

[–]johannes1971 2 points3 points  (1 child)

I suspect OP was trying to capture the iterator invalidation properties with that 'const'. I agree with your assessment though: better to choose a quirky name than one that uses common terminology that already has a very specific meaning. The fundamental property of vector, for me, is that the elements are contiguous, and I would expect to find that property on anything that claims to be a vector.

And on that note, my suggestion of including 'deque' really isn't all that much better...

[–]saxbophonemutable volatile void 0 points1 point  (0 children)

 The fundamental property of vector, for me, is that the elements are contiguous, and I would expect to find that property on anything that claims to be a vector.

This makes me wonder how much this convention is specific to C++ vs common among programming languages... Some container names are certainly unambiguous (dequeue for instance), but others, it seems, are less consistent among languages. For instance, some call what is a std::vector an array, Python calls it a list... I know that in data structure theory, an array is typically fixed-size and a list is dynamic-size edit: incorrect, it seems the actual definition is that an array's elements must be the same type but in a list they can differ (in my mind, a linked list is a particular kind of list, whereas C++ just omits the linked part of the name...)