STL - does every compiler implement it differently?

前端 未结 5 1672
臣服心动
臣服心动 2020-12-18 13:48

It was said to me that the standard template library is differently implemented by every compiler, is this correct?

How can computational complexity (both in time an

5条回答
  •  天命终不由人
    2020-12-18 14:17

    How can computational complexity (both in time and space) be observed if (for instance) the set container is implemented with a linked list rather than a red-black tree?

    SeaWorld San Antonio used to be owned by Anheuser-Busch. When Anheuser-Busch bought it, the weird liquor laws in Texas would have required Anheuser-Busch to sell only their competitors' beers at SeaWorld. It would have been illegal to sell Bud. Hence the Busch exception to those liquor laws. The Busch exception didn't name Anheuser-Busch or SeaWorld. That would have been a bit too blatant. But it nonetheless did allow SeaWorld to sell Bud, and it didn't apply anywhere else. Legislators are very adept at creating laws that target a very specific organization without naming that organization.

    The same applies to standards writers. The standard doesn't say red black trees anywhere, but the requirements are heavily rigged in favor of them. I doubt that even an AVL tree could meet those stringent insertion requirements. AVL trees give up some performance on insertion so as to make lookup as fast as possible. AVL trees are even faster than red-black trees with regard to search.

提交回复
热议问题