← Back to archive

Stdle #99 · overload · 2026-09-13

What does this C++ snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

#include <iostream>
struct S {
int operator()(int a, int b) { return a - b; }
};
int apply(S f, int x, int y) { return f(x, y); }
int main() {
std::cout << apply(S{}, 10, 3) << "\n";
}
Overload
4 attempts left

Answer & explanation