3 ms·
I don't think I would have completed the task at all had it not been for chatgpt (and the help on discord). I'd probably have had to rely on some kind soul doin
by suby 4y ago
I don't think I would have completed the task at all had it not been for chatgpt (and the help on discord). I'd probably have had to rely on some kind soul doing the whole thing for me, as I could not find a working example with the latest version of both libraries online anywhere. There probably is a working example somewhere, but I couldn't find it.
The service is down now so I can't post it, but there's definitely an art to phrasing it to do what you want. I had some cases where I told it what I wanted to do at a certain section in high level terms, but when given together it would produce garbage (using non-existent functions).
For example, if told to loop through the components from the argument list and add a component to the archive if it exists, it'd fail due to trying to accomplish the task in a more straight forward way (with functions that don't exist). However, I could break it down over the course of more prompts, so one prompt would be asking it to do a loop through components,
auto process_component_type = [&](auto component_type) {
};
(process_component_type(std::type_identity<Components>{}), ...);
Another prompt to extract the component type (this would go inside the loop)
using ComponentType = decltype(component_type)::type;
std::cout << "Processing component: " << typeid(ComponentType).name() << std::endl;
And then I myself could write (after the above)
if (registry.ctx().contains<ComponentType>())
{
std::cout << "Context contains";
archive(registry.ctx().get<ComponentType>());
}