Skip to content

combine() fails on containers with different size #160

@adan60

Description

@adan60

The code

#include <iostream>
#include <vector>
#include <boost/range/combine.hpp>
#include <boost/tuple/tuple.hpp>
int main() {
std::vector vec1 = { 1, 2 };
std::vector vec2 = { 5, 6, 7 };
const auto& zip_view = boost::range::combine(vec1, vec2);
std::cout << "boost::range::combine(vec1, vec2).size() = " << std::ranges::size(zip_view) << std::endl;
for (auto const& zipped : zip_view) {
int first, second;
boost::tie(first, second) = zipped;
std::cout << first << " " << second << std::endl;
}
return 0;
}

produces an output

boost::range::combine(vec1, vec2).size() = 2
1 5
2 6

and fails while access over vec1.end()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions