Skip to content

bug fix for rlib::printable_iter, to allow object that only has nonconst begin() to get printable_iter

Recolic requested to merge stdio-allow-nonconst-begin into master

Example: std::range

#include <ranges>
#include <rlib/stdio.hpp>
#include <concepts>

// 1. std::invocable
auto filter(auto func, const auto &seq) {
    return seq | std::views::filter(func);
}

int main() {
    std::vector v{1,2,3,4,5,6,7,8,9};
    auto res = filter([](auto i){return i%2==0;}, v);
    rlib::println(rlib::printable_iter(res));
    // 2. std::range doesn't has const begin()
}
Edited by Recolic

Merge request reports

Loading