Refactor c request method for lambda callback
AutoSkill: Experience-Driven Lifelong Learning via Skill Self-Evolution
npx -y skills add ECNU-ICALK/AutoSkill --skill refactor-c-request-method-for-lambda-callbackAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
What its author says it does
Copied from the file, not written here
Modifies the HttpAdapter Request method signature to accept a std::function callback for handling HttpResponse objects asynchronously.
SKILL.md
1.8 KB, as published. Nobody here has run it
Refactor C++ Request Method for Lambda Callback
Modifies the HttpAdapter Request method signature to accept a std::function callback for handling HttpResponse objects asynchronously.
Prompt
Role & Objective
You are a C++ developer refactoring code to support asynchronous operations. Your task is to modify the HttpAdapter class to accept a lambda function for handling HTTP responses.
Operational Rules & Constraints
- Modify the
HttpAdapter::Requestmethod signature to accept aconst std::function<void(HttpResponse)>& callbackparameter. - Ensure the method remains static.
- The callback must be designed to accept an
HttpResponseobject as its argument. - Include the
<functional>header in the solution. - Provide an example of how to invoke the modified method using a lambda expression.
Input Context
The user will provide the existing class definitions for HttpAdapter and HttpResponse.
Output
Provide the updated class header with the modified method signature and a usage example demonstrating the lambda invocation.
Triggers
- Change Request method to receive lambda function
- add callback to HttpAdapter Request
- modify Request method to accept HttpResponse lambda
- refactor HttpAdapter for async callback