[PATCH] D33919: [ADT] Make iterable SmallVector template overrides more specific
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 9 10:28:19 PDT 2017
dblaikie accepted this revision.
dblaikie added a comment.
This revision is now accepted and ready to land.
Please add a test case using a non-forward iterator to demonstrate that the traits checking is working as intended.
I think something like this, maybe:
TYPED_TEST(SmallVectorTest, InsertRepeatedNonForwardIterator) {
struct output_iterator {
typedef std::output_iterator_tag iterator_category;
typedef int value_type;
typedef int difference_type;
typedef value_type* pointer;
typedef value_type& reference;
// In theory other operations would be needed here, but they shouldn't be used in this test
operator int() { return 2; }
};
...
append(output_iterator(), output_iterator())
check that the vector describes the sequence {2, 2}
}
I suppose in theory this should be tested for all 4 operations you're updating here - if there's a tidy way to do that, great, but otherwise I'd probably just test one of them.
Also there seem to be 3 test cases but 4 code changes. The ctor change isn't tested at all - could you test that?
https://reviews.llvm.org/D33919
More information about the llvm-commits
mailing list