top | item 7612526

(no title)

devcodex | 12 years ago

The code that makes use of templates and such is meant to be library code in the same way that STL is, not something the average user interacts with other than to know they need to pass an Init and Destroy function followed by initialization parameters. I don't see people tearing apart <tuple>'s code because of its complexity, or <vector> or any other reusable STL component that most developers who've complained about the verbosity of my solution use every day without batting an eye.

In these proposed solutions I've not yet seen one that has the capability to do this:

    auto window = make_resource(SDL_CreateWindow, SDL_DestroyWindow, ....);
With my solution all you have to do is call make resource with different parameters it automatically works with other C style init/destroy created resources, not just from the SDL library but any C library that follows that practice.

Can you try posting what your solution to the general problem would look like?

discuss

order

No comments yet.