Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cartesian_product view, now with moar bugs #919

Closed
ericniebler opened this issue Oct 16, 2018 · 0 comments · Fixed by #920
Closed

cartesian_product view, now with moar bugs #919

ericniebler opened this issue Oct 16, 2018 · 0 comments · Fixed by #920
Assignees
Labels

Comments

@ericniebler
Copy link
Owner

The following program:

#include <range/v3/span.hpp>
#include <range/v3/size.hpp>
#include <range/v3/view/cartesian_product.hpp>

using namespace ranges;

int main()
{
    int some_ints[] = {0,1,2,3};
    char const * some_strings[] = {"John", "Paul", "George", "Ringo"};
    auto rng = view::cartesian_product(
        span<int, size(some_ints)>{some_ints},
        span<char const*, size(some_strings)>{some_strings}
    );
    (void)(rng.end() - 1);
}

results in the following assertion:

prog.exe: /opt/wandbox/range-v3/include/range/v3/view/cartesian_product.hpp:194: void ranges::v3::
cartesian_product_view<ranges::v3::span<int, 4>, ranges::v3::span<const char *, 4> >::cursor<true>
::advance_(meta::size_t<N>, std::ptrdiff_t) [Views = <ranges::v3::span<int, 4>, ranges::v3::span<c
onst char *, 4>>, IsConst = true, N = 1]: Assertion `0 <= idx && idx < my_size' failed.

Aborted

https://wandbox.org/permlink/c1qymFJLEFnTJNHk

CaseyCarter added a commit to CaseyCarter/range-v3 that referenced this issue Oct 16, 2018
* Use `std::intmax_t` for size and difference types
* Implement `static size` when all `View` types have fixed cardinatlity
* Rethink `advance` (Fixes ericniebler#919)
CaseyCarter added a commit to CaseyCarter/range-v3 that referenced this issue Oct 16, 2018
* Use `std::intmax_t` for size and difference types
* Implement `static size` when all `View` types have fixed cardinatlity
* Rethink `advance` (Fixes ericniebler#919)
CaseyCarter added a commit to CaseyCarter/range-v3 that referenced this issue Oct 16, 2018
* Use `std::intmax_t` for size and difference types
* Implement `static size` when all `View` types have fixed cardinatlity
* Rethink `advance` (Fixes ericniebler#919)
CaseyCarter added a commit to CaseyCarter/range-v3 that referenced this issue Oct 16, 2018
* Use `std::intmax_t` for size and difference types
* Implement `static size` when all `View` types have fixed cardinatlity
* Rethink `advance` (Fixes ericniebler#919)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants