c++ - Is there a design reason why std::set doesnt have front and back member functions? -


  1. i know can use *s.begin(), same argument can used vector, has front/back
  2. often use ordered property of set/map "smallest" element/key - ofc fact i not reason have it, example :)

here i'm talking design reasons why front/back bad design, please skip obvious reasons committee forgot it...

i imagine words "front" , "back" reserved sequence containers (i.e. order of elements determined order of insertion), , words meant suggest physical position in sequence.

since set not sequence container (but instead associative container), isn't appropriate. in particular, note meaning of "front" can change later insertions of unrelated element.


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -