-
-
Notifications
You must be signed in to change notification settings - Fork 263
Open
Description
In the following example, the type of x and y won't be shown in the output:
#include <cstdlib>
#include <ranges>
#include <print>
#include <span>
int main() {
auto const i = std::views::iota(1, 21);
auto const sq = i | std::views::transform([](auto x) { return x * x; });
auto const trip =
i | std::views::transform([](auto x) { return x * x * x; });
auto const z = std::views::zip(i, sq, trip);
auto x = std::size(i);
auto y = std::size(sq);
auto u = std::size(z);
std::println("{} {} {}", x, y, u);
return EXIT_SUCCESS;
}
The output reads:
#include <cstdlib>
#include <ranges>
#include <print>
#include <span>
int main()
{
const std::ranges::iota_view<int, int> i = std::ranges::views::iota.operator()(1, 21);
class __lambda_8_45
{
public:
template<class type_parameter_0_0>
inline /*constexpr */ auto operator()(type_parameter_0_0 x) const
{
return x * x;
}
#ifdef INSIGHTS_USE_TEMPLATE
template<>
inline /*constexpr */ int operator()<int>(int x) const
{
return x * x;
}
#endif
private:
template<class type_parameter_0_0>
static inline /*constexpr */ auto __invoke(type_parameter_0_0 x)
{
return __lambda_8_45{}.operator()<type_parameter_0_0>(x);
}
public:
// inline /*constexpr */ __lambda_8_45() noexcept = default;
// inline /*constexpr */ __lambda_8_45(const __lambda_8_45 &) noexcept = default;
// inline /*constexpr */ __lambda_8_45(__lambda_8_45 &&) noexcept = default;
// /*constexpr */ __lambda_8_45() = default;
} __lambda_8_45{};
const std::ranges::transform_view<std::ranges::iota_view<int, int>, __lambda_8_45> sq = std::ranges::views::__adaptor::operator|(i, static_cast<const std::ranges::views::__adaptor::_RangeAdaptor<std::ranges::views::_Transform>&>(std::ranges::views::transform).operator()(__lambda_8_45));
class __lambda_10_33
{
public:
template<class type_parameter_0_0>
inline /*constexpr */ auto operator()(type_parameter_0_0 x) const
{
return (x * x) * x;
}
#ifdef INSIGHTS_USE_TEMPLATE
template<>
inline /*constexpr */ int operator()<int>(int x) const
{
return (x * x) * x;
}
#endif
private:
template<class type_parameter_0_0>
static inline /*constexpr */ auto __invoke(type_parameter_0_0 x)
{
return __lambda_10_33{}.operator()<type_parameter_0_0>(x);
}
public:
// inline /*constexpr */ __lambda_10_33() noexcept = default;
// inline /*constexpr */ __lambda_10_33(const __lambda_10_33 &) noexcept = default;
// inline /*constexpr */ __lambda_10_33(__lambda_10_33 &&) noexcept = default;
// /*constexpr */ __lambda_10_33() = default;
} __lambda_10_33{};
const std::ranges::transform_view<std::ranges::iota_view<int, int>, __lambda_10_33> trip = std::ranges::views::__adaptor::operator|(i, static_cast<const std::ranges::views::__adaptor::_RangeAdaptor<std::ranges::views::_Transform>&>(std::ranges::views::transform).operator()(__lambda_10_33));
const std::ranges::zip_view<std::ranges::iota_view<int, int>, std::ranges::transform_view<std::ranges::iota_view<int, int>, __lambda_8_45>, std::ranges::transform_view<std::ranges::iota_view<int, int>, __lambda_10_33> > z = std::ranges::views::zip.operator()(i, sq, trip);
x = std::size(i);
y = std::size(sq);
unsigned int u = std::size(z);
std::println(std::basic_format_string<char, unsigned int &, unsigned int &, unsigned int &>("{} {} {}"), x, y, u);
return 0;
}
Note that neither x nor y have a type in front of them, so the code is in fact invalid.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels