TGViewer
С++ Собеседования С++ Собеседования @cppsobes · 732 subscribers
Post #63 903
🔍 Что выведет этот код C++23?


constexpr auto make_checker() {
return [](int x) consteval {
return x % 3 == 0 || x % 5 == 0;
};
}

int main() {
auto checker = make_checker();
std::vector<int> numbers{1, 3, 5, 9, 10, 14, 15};
auto filtered = numbers | std::views::filter([&](int x) {
return checker(x);
});
for (int x : filtered)
std::print("{} ", x);
}


🧠 Попробуй угадать результат — он может удивить!

@cppsobes
  • 🤔 4
  • 👍 1
More from @cppsobes
  1. Oct 20, 2025Post #72
  2. Aug 11, 2025Post #71
  3. Aug 11, 2025photo post
  4. Jul 12, 2025Что выведет код ?
  5. Jul 2, 2025Post #67
  6. Jul 2, 2025photo post
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →