PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Qube Research & Technologies

Implement a type-erased function wrapper

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's understanding of C++ type erasure, callable wrappers, object lifetime and copy/move semantics, and exception-safety considerations when implementing a minimal std::function-like template.

  • Medium
  • Qube Research & Technologies
  • Coding & Algorithms
  • Software Engineer

Implement a type-erased function wrapper

Company: Qube Research & Technologies

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

Implement a minimal std::function-like callable wrapper in C++ using type erasure via inheritance and a virtual call. Define a template Function<R(Args...)> that can store and invoke any callable (function pointer, lambda with captures, or functor), supports copy/move construction and assignment, operator(), destruction, and a boolean conversion for an empty state. You may ignore small-buffer optimization and heap/memory constraints. Explain exception-safety choices and the time/space costs of invocation and copies compared to the standard library version.

Quick Answer: This question evaluates a candidate's understanding of C++ type erasure, callable wrappers, object lifetime and copy/move semantics, and exception-safety considerations when implementing a minimal std::function-like template.

Related Interview Questions

  • Implement flat_map and design wealth redistribution - Qube Research & Technologies (Medium)
  • Implement flat_map, redistribute wealth evenly - Qube Research & Technologies (Medium)
Qube Research & Technologies logo
Qube Research & Technologies
Sep 6, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
4
0

Implement a minimal std::function-like callable wrapper in C++ using type erasure via inheritance and a virtual call. Define a template Function<R(Args...)> that can store and invoke any callable (function pointer, lambda with captures, or functor), supports copy/move construction and assignment, operator(), destruction, and a boolean conversion for an empty state. You may ignore small-buffer optimization and heap/memory constraints. Explain exception-safety choices and the time/space costs of invocation and copies compared to the standard library version.

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Qube Research & Technologies•More Software Engineer•Qube Research & Technologies Software Engineer•Qube Research & Technologies Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.