sewenew / redis-plus-plus

Redis client written in C++
Apache License 2.0
1.64k stars 351 forks source link

[BUG] error passing transformed view to hmset #358

Closed Spongman closed 2 years ago

Spongman commented 2 years ago

this works:

    std::vector blah{
        std::make_pair("1", "1"),
        std::make_pair("2", "2"),
        std::make_pair("3", "3"),
    };
    redis.hmset("mymap", blah.begin(), blah.end());

however, this:

    std::vector bars{"1", "2", "3"};
    const auto foos = bars | std::views::transform([](auto a) { return std::make_pair(a, a); });
    redis.hmset("mymap", foos.begin(), foos.end());

gives:

/usr/include/sw/redis++/command_args.h:169:18: error: base operand of '->' has non-pointer type 'std::ranges::transform_view<std::ranges::ref_view<std::vector<const char*> >, policynet::ResourceManager::retrieveLatestNodes()::<lambda(auto:114)> >::_Iterator<true>'
  169 |         *this << first->first << first->second;
      |                  ^~~~~

A clear and concise description of what you expected to happen.

sewenew commented 2 years ago

The problem is that transform_view::iterator does not override operator ->.

I've fixed the problem. Please check the latest code on master branch.

Thanks for reporting the bug!

Regards

sewenew commented 2 years ago

Since there's no update, I'll close the issue. If you still have the problem, feel free to reopen it.

Regards