Quote Originally Posted by coleb
Quote Originally Posted by Tanek
You can also write your own very simplified shared_ptr and give an option to the user to use the implementation they want (like you did for vector and string). I question more the design (using a standard and non intrusive reference counting) than the implementation.
That's essentially what detail::Wrapper is, an implementation of shared_ptr.

Also note the design of OpenCL C++ layer does not preclude you from using shared_ptr. The following should work:
Code :
std::shared_ptr<cl::Image2D> imagePtr;

It may even be preferable from a performance point of view since std::shared_ptr is implemented using atomics and cl::detail::Wrapper is implemented using cl(Retain/Release)*. If the above doesn't work let us know and we can make sure the OpenCL C++ layer can accomodate it.
If cl::Wrapper was an implementation of shared_ptr it would not be the parent of all the class of OpenCL or is there something I don't get? Also the constructor and destructor of Image2D are using the function retain/release (indirectly by calling the constructor/destructor of Wrapper) so I don't see how shared_ptr could be faster than using cl::Wrapper since anyway the functions of cl::Wrapper will be called by shared_ptr.

[quote:g2mg0dsh]
Premature optimization is the root of all evil. I have a production multi-threaded database server application that makes heavy use of the getInfo methods and have never seen a performance issue. If there is one the vendor should be notified.

There are good reasons to keep the objects as lightweight as possible, i.e., sizeof(cl::Context) == sizeof(cl_context). When passing the objects to an argument handler they are very easy to translate into what OpenCL C needs. Also, the interface is very easy to update when new properties are added to the various OpenCL C objects (it's a single table within the header file).
[/quote[

You convinced me on this one .

[quote:g2mg0dsh]
Thanks for the feedback, I hope you find the bindings useful enough to suit your needs.
[/quote:g2mg0dsh][/quote:g2mg0dsh]

Thanks for your time answering my questions!