remove using namespace std and use std namespace explicitly (#2125)

Removes `using namespace std` and adds `std::` explicitly instead, which
is usually on calls to `min`.

This is generally best practice, and it also might be helpful when there
are the same function names in the std namespace and in the global
namespace (e.g. #1833).
This commit is contained in:
Ben Ashbaugh
2024-10-29 09:44:49 -07:00
committed by GitHub
parent 8369028c92
commit d8228f0d72
13 changed files with 40 additions and 71 deletions

View File

@@ -17,8 +17,6 @@
#include <algorithm>
using namespace std;
struct image_kernel_data
{
cl_int width;
@@ -383,17 +381,18 @@ int test_image_methods_depth(cl_device_id device, cl_context context,
glGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT, &maxTextureRectangleSize);
glGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, &maxTextureLayers);
size = min(maxTextureSize, maxTextureRectangleSize);
size = std::min(maxTextureSize, maxTextureRectangleSize);
RandomSeed seed(gRandomSeed);
// Generate some random sizes (within reasonable ranges)
for (size_t i = 0; i < nsizes; i++)
{
sizes[i].width = random_in_range(2, min(size, 1 << (i + 4)), seed);
sizes[i].height = random_in_range(2, min(size, 1 << (i + 4)), seed);
sizes[i].width = random_in_range(2, std::min(size, 1 << (i + 4)), seed);
sizes[i].height =
random_in_range(2, std::min(size, 1 << (i + 4)), seed);
sizes[i].depth =
random_in_range(2, min(maxTextureLayers, 1 << (i + 4)), seed);
random_in_range(2, std::min(maxTextureLayers, 1 << (i + 4)), seed);
}
for (size_t i = 0; i < nsizes; i++)
@@ -440,11 +439,11 @@ int test_image_methods_multisample(cl_device_id device, cl_context context,
for (size_t i = 0; i < nsizes; i++)
{
sizes[i].width =
random_in_range(2, min(maxTextureSize, 1 << (i + 4)), seed);
random_in_range(2, std::min(maxTextureSize, 1 << (i + 4)), seed);
sizes[i].height =
random_in_range(2, min(maxTextureSize, 1 << (i + 4)), seed);
random_in_range(2, std::min(maxTextureSize, 1 << (i + 4)), seed);
sizes[i].depth =
random_in_range(2, min(maxTextureLayers, 1 << (i + 4)), seed);
random_in_range(2, std::min(maxTextureLayers, 1 << (i + 4)), seed);
}
glEnable(GL_MULTISAMPLE);