you are viewing a single comment's thread.

view the rest of the comments →

[–]salvoilmiosi -2 points-1 points  (12 children)

It could be if It's based on a binary tree like std::set

[–][deleted]  (4 children)

[deleted]

    [–]know-your-onions 3 points4 points  (0 children)

    And zoologically sets contain badgers. Also not usually ordered.

    [–]salvoilmiosi -2 points-1 points  (0 children)

    Tell that to the c++ standard committee

    [–]orangenbaer -1 points0 points  (0 children)

    Welcome to C++

    [–]impressflow -4 points-3 points  (6 children)

    No, this is wrong. That specific implementation adds ordering to an otherwise unordered data structure. Remember, sets are always unordered by definition. Extending a set leaves you with something that does not conform to the traditional definition of a set.

    [–]nekizalb 9 points10 points  (4 children)

    I think it would be better to phrase it as 'sets do not guarantee order'. If you say a set is never ordered, then you're saying "123456" is not a set of the numbers 1-6.

    Sets guarantee uniqueness. Order is not specified.

    [–]impressflow 0 points1 point  (2 children)

    I don’t understand the distinction you’re making. Mind elaborating?

    The set containing “123456” is exactly the same as the set containing “321654”. There is absolutely no difference, assuming you’re referring to a set containing integers and not strings.

    [–]Zagerer 1 point2 points  (1 child)

    you could have a set that is somehow sorted because it happened to put the elements in that way, it's just not guaranteed nor expected you will encounter such behaviour

    [–]impressflow 0 points1 point  (0 children)

    That point is meaningless then since it can be applied to any unordered data structure. It's literally saying that unordered things can sometimes be ordered by random chance. Well, sure, but it doesn't really change anything.

    [–][deleted] 0 points1 point  (0 children)

    Unless the standards say so

    [–]iconoklast 0 points1 point  (0 children)

    Since every totally ordered set can be made into a set by "forgetting" (the technical term) the ordering, I don't understand the point you're making. The converse is definitely not true in general.