Namespaces
Variants
Views
Actions

Difference between revisions of "Talk:cpp/named req/Container"

From cppreference.com
Line 12: Line 12:
  
 
Should the table for ::size and ::max_size be more explicit about this?
 
Should the table for ::size and ::max_size be more explicit about this?
 +
 
[[Special:Contributions/69.84.133.248|69.84.133.248]] 13:39, 20 June 2012 (PDT) Charles Wilcox
 
[[Special:Contributions/69.84.133.248|69.84.133.248]] 13:39, 20 June 2012 (PDT) Charles Wilcox

Revision as of 12:40, 20 June 2012

I thought the complexity of 'Container::size_type Container::size() const' is only required to be linear, not constant.

std::list is the canonical example of this, where some implementations have a Linear complexity.

"Effective STL" by Scott Meyers - Item 4. Call empty instead of checking size() against zero.

http://www.sgi.com/tech/stl/Container.html#10. I know, this isn't the Standard.

Referring to ISO/IEC 14882:2003, Section 23.1, I see that its complexity for ::size, as well as ::max_size is "should be constant", implying that it won't always be.

I just added a note saying that std::list is an exception to the constant complexity.

Should the table for ::size and ::max_size be more explicit about this?

69.84.133.248 13:39, 20 June 2012 (PDT) Charles Wilcox