▸case-01 In a C++20 library, I want to constrain a generic function `serialize(T val)` so that it only accepts integral types. A legacy implementation uses `std::enable_if_t<std::is_integral_v<T>>` in the function signature. Rewrite this template header using C++20 standard concepts syntax without SFINAE helpers. | pass→pass | 5,028 | 5,887 | +17% | 1 | 1 | 0% | 920 | 1,370 | +49% | 0 | 0 | — |
▸case-02 I am refactoring a C++ function `parse_port(std::string_view s)` that currently returns `std::pair<bool, uint16_t>` where false indicates a parsing error message is needed. In C++23, I want to return either the parsed `uint16_t` value or an error string `std::string` without throwing C++ exceptions or returning a pair/tuple. Show the function signature and error return statement using the C++23 standard sum-type error handling vocabulary. | pass→pass | 5,195 | 4,956 | -5% | 1 | 1 | 0% | 1,155 | 1,308 | +13% | 0 | 0 | — |
▸case-03 I have a high-performance C++20 processing function `process_buffer` that takes a contiguous sequence of read-only `float` elements. Callers currently pass `const std::vector<float>&`, which prevents passing raw C arrays or `std::array` without temporary memory allocations. Update the parameter type to the non-owning contiguous view container introduced in C++20. | pass→pass | 5,405 | 5,749 | +6% | 1 | 1 | 0% | 1,107 | 1,251 | +13% | 0 | 0 | — |
▸case-04 In a multithreaded C++20 queue, worker threads frequently update adjacent atomic counters in a struct, causing cache line bouncing and performance degradation due to false sharing. Show how to declare struct member alignment using the standard C++ core library cache line size constant. | pass→pass | 11,050 | 11,010 | -0% | 1 | 1 | 0% | 1,774 | 2,187 | +23% | 0 | 0 | — |
▸case-05 In a C++20 lock-free ring buffer, a single producer thread writes payload data and updates a write index atomic variable (`std::atomic<size_t> write_idx`). The producer uses default `memory_order_seq_cst` when calling `store`. Specify the optimal non-sequential memory ordering flag for this store operation to eliminate unnecessary fence overhead on ARM processors. | pass→pass | 6,723 | 6,708 | -0% | 1 | 1 | 0% | 1,133 | 1,340 | +18% | 0 | 0 | — |
▸case-06 In C++20, I need to tokenize a string parameter `std::string_view input` by a comma separator `,` and process each segment without heap allocations or creating intermediate `std::vector<std::string>` instances. Write a C++20 ranges pipeline expression to achieve this. | pass→pass | 14,464 | 11,904 | -18% | 1 | 1 | 0% | 2,896 | 2,508 | -13% | 0 | 0 | — |
▸case-07 A C++ service builds log lines using `snprintf` into temporary character arrays. Refactor `log_entry(std::string_view level, int code)` to return a `std::string` constructed using the type-safe C++20 standard formatting library. | pass→pass | 8,112 | 7,909 | -3% | 1 | 1 | 0% | 1,512 | 1,639 | +8% | 0 | 0 | — |
▸case-08 I need a compile-time lookup function `constexpr std::string_view lookup_code(int key)` converting status codes (1 through 5) to descriptions in C++20. I want to eliminate runtime heap allocation from static initialization of `std::unordered_map`. Implement this using `constexpr` and fixed-size static evaluation. | pass→pass | 11,206 | 9,723 | -13% | 1 | 1 | 0% | 2,212 | 2,154 | -3% | 0 | 0 | — |
▸case-17 A legacy codebase manages dynamic buffer memory with raw calls `Buffer* buf = new Buffer[1024];` and explicit manual calls to `delete[] buf;`. Modernize this memory management by replacing raw dynamic allocations with safe RAII ownership using standard smart pointers. | pass→fail | 11,981 | 10,659 | -11% | 1 | 1 | 0% | 2,221 | 2,172 | -2% | 0 | 0 | — |
▸case-09 I want to write a C++23 lazy generator function `fibonacci()` that yields infinite Fibonacci numbers sequentially using `co_yield`. What C++23 standard library header type should be declared as the return type? | pass→pass | 4,991 | 4,006 | -20% | 1 | 1 | 0% | 758 | 872 | +15% | 0 | 0 | — |
▸case-10 I need a variadic C++17/20 template function `sum_all(Args... args)` that calculates the sum of all provided arguments. In C++11 this required recursive template overload unpacks. Write this using modern fold expression syntax. | fail→pass | 9,294 | 11,786 | +27% | 1 | 1 | 0% | 1,903 | 2,500 | +31% | 0 | 0 | — |
▸case-11 I am writing a factory function template `template <typename T, typename... Args> std::unique_ptr<T> create_object(Args&&... args)` that forwards constructor parameters to `std::make_unique`. How must the parameter pack `args` be wrapped when passed to `std::make_unique` to preserve rvalue/lvalue value categories? | pass→pass | 5,821 | 4,986 | -14% | 1 | 1 | 0% | 1,214 | 1,134 | -7% | 0 | 0 | — |
▸case-12 In a multi-threaded C++20 simulation, an existing contiguous array `std::vector<double> data` requires atomic additions on individual elements without modifying the underlying vector element type to `std::atomic<double>`. What C++20 standard class template provides atomic operations on non-atomic variable references? | pass→pass | 4,425 | 4,623 | +4% | 1 | 1 | 0% | 806 | 1,220 | +51% | 0 | 0 | — |
▸case-13 In C++23, I need to store tasks in a queue `std::queue<Task>`. A task lambda captures a move-only `std::unique_ptr<Resource>` by value. Standard `std::function` fails compilation because it demands copy-constructible objects. What C++23 standard wrapper replaces `std::function` for move-only callables? | pass→pass | 6,246 | 5,065 | -19% | 1 | 1 | 0% | 1,031 | 1,154 | +12% | 0 | 0 | — |
▸case-14 Eight worker threads must synchronize at a single initialization checkpoint before proceeding to run tasks. Pre-C++20 implementations used `std::mutex` and `std::condition_variable` with a counter. What single-use countdown synchronization class from C++20 `<latch>` should be used instead? | pass→pass | 3,485 | 4,356 | +25% | 1 | 1 | 0% | 692 | 1,051 | +52% | 0 | 0 | — |
▸case-15 In C++23, I want to implement a recursive lambda `fib` directly without wrapping it in `std::function` or passing `self` manually in every caller invocation. What C++23 feature allows a lambda to inspect its own closure object via explicit object parameter syntax? | pass→pass | 4,899 | 4,620 | -6% | 1 | 1 | 0% | 907 | 935 | +3% | 0 | 0 | — |
▸case-16 In a C++20 resource manager class, calling `acquire_lock()` returns an RAII handle. If a developer calls `acquire_lock()` without storing the return value, the temporary handle instantly destroys, releasing the lock prematurely. What standard attribute forces a compiler warning when the return value is discarded? | pass→pass | 3,290 | 3,825 | +16% | 1 | 1 | 0% | 564 | 865 | +53% | 0 | 0 | — |
▸case-18 In a high-frequency trading C++23 switch statement over a custom enum with four possible values, the default case is logically impossible. Instead of calling `exit(1)` or throwing, what C++23 standard function informs the compiler that default execution is unreachable for optimization? | pass→pass | 4,769 | 5,797 | +22% | 1 | 1 | 0% | 785 | 1,039 | +32% | 0 | 0 | — |
▸case-19 A C++ component configures event listeners using `std::bind(&Worker::process, this, std::placeholders::_1)`. Refactor this binding into a modern C++ lambda expression without `std::bind` or placeholders. | pass→pass | 6,087 | 7,957 | +31% | 1 | 1 | 0% | 1,068 | 1,620 | +52% | 0 | 0 | — |
▸case-20 In C++20, removing odd integer elements from `std::vector<int> numbers` no longer requires the classic erase-remove idiom `numbers.erase(std::remove_if(...), numbers.end())`. Show the simplified C++20 non-member standard algorithm call. | pass→pass | 3,198 | 3,443 | +8% | 1 | 1 | 0% | 636 | 726 | +14% | 0 | 0 | — |
▸case-21 A packet parser checks if an unsigned 32-bit integer `header_flags` is a power of two using GCC intrinsic `__builtin_popcount`. What C++20 standard header and template function replace vendor intrinsics for power-of-two inspection? | pass→pass | 4,348 | 4,844 | +11% | 1 | 1 | 0% | 875 | 1,112 | +27% | 0 | 0 | — |
▸case-22 In C++20, I have a class `Point2D` with `int x` and `int y`. I want to auto-generate all six relational operators (`==`, `!=`, `<`, `<=`, `>`, `>=`) with standard lexicographical order. Show the single operator signature inside the class declaration. | pass→pass | 5,344 | 3,138 | -41% | 1 | 1 | 0% | 776 | 693 | -11% | 0 | 0 | — |
▸case-23 Write a pure C99 code snippet that initializes a POSIX mutex `pthread_mutex_t lock` and locks it before modifying a shared global integer `counter`. Ensure the output is C-compatible without C++ standard headers. | pass→pass | 6,826 | 9,692 | +42% | 1 | 1 | 0% | 1,530 | 1,510 | -1% | 0 | 0 | — |
▸case-24 Write a CMake 3.20 `CMakeLists.txt` configuration script that creates an executable target named `server_app` from source file `main.cpp` and configures its target C++ standard to C++20. | pass→pass | 5,266 | 4,104 | -22% | 1 | 1 | 0% | 1,135 | 951 | -16% | 0 | 0 | — |
▸case-25 Write x86-64 AT&T syntax assembly instructions for a Leaf function `add_vals` that takes two 64-bit integer arguments in `%rdi` and `%rsi`, adds them together, and returns the result in `%rax`. | pass→pass | 4,895 | 4,530 | -7% | 1 | 1 | 0% | 945 | 1,107 | +17% | 0 | 0 | — |