Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

14
  • 2
    Have a look at github.com/kennytm/utils/blob/master/traits.hpp Commented Apr 25, 2015 at 11:44
  • So, you pass in callables, deduce the types needed to call it, check if you have those types, and then invoke. That implies that you can only ever have one object of a given type in your entity, which seems like a strange restriction. Two small changes to your linked code make it compile. Commented Apr 25, 2015 at 13:16
  • You need the argument types? If the lambda isn't generic, just look at its operator(). Commented Apr 25, 2015 at 13:18
  • To be insane, the dual of an entity is of type any(any) -> (any|typeerror) (to mix haskell and C++ function notation horribly). Curry incoming functions, feed to duals of entities, done? Naw, doesn't work, as mapping auto(auto) to any(any) isn't feasible, and finding what entity dual to call requires linear search of the entities. Both can be fixed, but basically involve manual or automatic signature deduction, which make it silly. Commented Apr 25, 2015 at 13:52
  • @Yakk "That implies that you can only ever have one object of a given type in your entity, which seems like a strange restriction." What do you mean? With that given code, every entity can contain any number of other object types. Commented Apr 25, 2015 at 15:17