Поиск std::nullopt и nullptr с помощью std::ranges::find не компилируется

#include <algorithm>
#include <memory>
#include <optional>
#include <ranges>

std::optional<int> x[42];

auto it  = std::find(x, x + 42, std::nullopt);
auto it2 = std::ranges::find(x, x + 42, std::nullopt);

std::unique_ptr<int> y[42];

auto it3 = std::find(y, y + 42, nullptr);
auto it4 = std::ranges::find(y, y + 42, nullptr);

Почему std::find компилируется, а std::ranges::find - нет? Godbolt.

error: no match for call to '(const std::ranges::__find_fn) (std::optional [42], std::optional*, const std::nullopt_t&)'

error: no match for call to '(const std::ranges::__find_fn) (std::unique_ptr [42], std::unique_ptr*, std::nullptr_t)'


Ответы (0 шт):