You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, how would I begin to create binding code for the following method:
template <typename ComponentType, typename... Args>
voidadd_component(GameObjectID game_object_id, Args &&...args) {
// Check if the game object is registered or notif (!game_objects_.contains(game_object_id)) {
throwRegistryException("game object", game_object_id);
}
// Check if the component already exists in the registryif (has_component(game_object_id, typeid(ComponentType))) {
return;
}
// Add the component to the registry
components_[typeid(ComponentType)].insert(game_object_id);
game_objects_[game_object_id][typeid(ComponentType)] = std::make_shared<ComponentType>(std::forward<Args>(args)...);
}
It takes in a ComponentType template parameter, a GameObjectId parameter and an arbitrary number of Args. I've got this binding code to begin with:
In template: no matching function for call to 'construct_at' error occurred here in instantiation of function template specialization 'std::_Construct_in_place<Upgrades>' requested here in instantiation of function template specialization 'std::_Ref_count_obj2<Upgrades>::_Ref_count_obj2<>' requested here in instantiation of function template specialization 'std::make_shared<Upgrades>' requested here in instantiation of function template specialization 'Registry::add_component<Upgrades>' requested here in instantiation of function template specialization 'bind_components<Armour, ArmourRegen, Attacks, EffectApplier, Footprints, Health, Inventory, KeyboardMovement, Money, MovementForce, StatusEffects, SteeringMovement, Upgrades>' reques... candidate template ignored: substitution failure [with _Ty = Upgrades, _Types = <>]: no matching constructor for initialization of 'Upgrades'
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, how would I begin to create binding code for the following method:
It takes in a
ComponentType
template parameter, aGameObjectId
parameter and an arbitrary number ofArgs
. I've got this binding code to begin with:But I get the following error:
The
Upgrades
constructor:Beta Was this translation helpful? Give feedback.
All reactions