This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Fix max_size() across all containers
ClosedPublic

Authored by EricWF on Nov 18 2016, 8:56 PM.

Details

Summary

The max_size() method of containers should respect both the allocator's reported max_size and the range of the difference_type. This patch makes all containers choose the smallest of those two values.

Event Timeline

EricWF updated this revision to Diff 78619.Nov 18 2016, 8:56 PM
EricWF retitled this revision from to [libcxx] Fix max_size() across all containers.
EricWF updated this object.
EricWF added a reviewer: mclow.lists.
EricWF added a subscriber: cfe-commits.
mclow.lists added inline comments.Nov 20 2016, 3:56 PM
test/std/containers/associative/map/map.access/max_size.pass.cpp
24

How about a newline here? (after the template<>)

And why not hoist this into "test_allocator.h"?

EricWF updated this revision to Diff 79007.Nov 22 2016, 5:26 PM
EricWF updated this object.

Address mclows changes

This patch reminds me; The way we test our containers is ridiculous. We should have a single template that tests the container requirements, and each container test should just use that template.

Anyway. accepting before commit.

test/std/containers/associative/map/map.access/max_size.pass.cpp
24

I'll change the .clang-format to add newlines after templates, and move this to test_allocator.h

EricWF accepted this revision.Nov 22 2016, 5:28 PM
EricWF added a reviewer: EricWF.
This revision is now accepted and ready to land.Nov 22 2016, 5:28 PM
EricWF closed this revision.Nov 22 2016, 5:28 PM