The slide "C++ Interface: setting up the host program" recommends using
using namespace cl;
using namespace std;
However, these namespaces have conflicts, particularly size_t and copy. This can lead to some very strange errors (for example, changing a buffer from cl::Buffer to cl::BufferGL causes the std::copy template to become the best match and it tries to treat cl::BufferGL as an output iterator; or declaring a size_t variable leads to errors because it was expecting a template parameter).
Even if the code works, I think that it is useful to make it clear which things are coming from the cl namespace.
The slide "C++ Interface: setting up the host program" recommends using
However, these namespaces have conflicts, particularly
size_t
andcopy
. This can lead to some very strange errors (for example, changing a buffer from cl::Buffer to cl::BufferGL causes the std::copy template to become the best match and it tries to treat cl::BufferGL as an output iterator; or declaring a size_t variable leads to errors because it was expecting a template parameter).Even if the code works, I think that it is useful to make it clear which things are coming from the cl namespace.