Logo

Question preview

Call it.

What this preview is

About this preview

Call it. is a easy quant interview question on language knowledge in Cpp.

Unlock full access to getcracked

Join to unlock this question, detailed solutions, and our complete library of quant finance interview prep.

Understanding callable types in C++ generic algorithms

This is an easy C++ question that tests your working knowledge of callable objects and how they interact with template functions. It's the kind of practical language detail that comes up when writing generic code—particularly in interview settings where candidates must reason about type compatibility without running the compiler.

The question requires you to distinguish between the different categories of callables in C++: function pointers, function objects (classes with operator()), lambda expressions, and std::function wrappers. A well-designed generic foreach should accept most of these, but there are subtle cases where type constraints or syntax rules can exclude certain forms. The skill being tested is your ability to reason about which callable types will and will not compile with a given template signature.

  • Function pointers and their decay rules
  • Functor objects and operator overloading
  • Lambda capture and template instantiation
  • Type deduction in template parameters