Closed
Description
I cannot use ElementsAre
with gsl::span
TEST(demo, elements_are_on_gsl_span)
{
std::array<int, 4> data = { 1, 2, 3, 4 };
gsl::span<int, 4> span(data);
ASSERT_THAT(span, ::testing::ElementsAre(1, 2, 3, 4));
}
because the current implementation of ElementsAreMatcherImpl
explicitely references typename StlContainer::const_iterator
bool MatchAndExplain(Container container,
MatchResultListener* listener) const override {
// To work with stream-like "containers", we must only walk
// through the elements in one pass.
const bool listener_interested = listener->IsInterested();
// explanations[i] is the explanation of the element at index i.
::std::vector<std::string> explanations(count());
StlContainerReference stl_container = View::ConstReference(container);
typename StlContainer::const_iterator it = stl_container.begin();
...
which does not exist for gsl::span
.
Could we use auto instead?
auto it = stl_container.begin();
Metadata
Metadata
Assignees
Labels
No labels