Avoid opening namespace std

This commit is contained in:
Chris Thrasher 2022-06-28 12:13:32 -06:00 committed by Lukas Dürrenberger
parent 8561101b11
commit 45986c6400

View File

@ -4,19 +4,26 @@
#include <doctest/doctest.h>
#include <GraphicsUtil.hpp>
#include <cassert>
#include <vector>
namespace std
// Use StringMaker to avoid opening namespace std
namespace doctest
{
std::ostream& operator<<(std::ostream& out, const std::vector<float>& vector)
template <>
struct StringMaker<std::vector<float>>
{
out << "{ ";
for (size_t i = 0; i + 1 < vector.size(); ++i)
out << vector[i] << ", ";
out << vector.back() << " }";
return out;
}
} // namespace std
static String convert(const std::vector<float>& vector)
{
assert(!vector.empty());
doctest::String out = "{ ";
for (size_t i = 0; i + 1 < vector.size(); ++i)
out += toString(vector[i]) + ", ";
out += toString(vector.back()) + " }";
return out;
}
};
} // namespace doctest
TEST_CASE("sf::Transform class - [graphics]")
{