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 <doctest/doctest.h>
#include <GraphicsUtil.hpp> #include <GraphicsUtil.hpp>
#include <cassert>
#include <vector> #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 << "{ "; static String convert(const std::vector<float>& vector)
{
assert(!vector.empty());
doctest::String out = "{ ";
for (size_t i = 0; i + 1 < vector.size(); ++i) for (size_t i = 0; i + 1 < vector.size(); ++i)
out << vector[i] << ", "; out += toString(vector[i]) + ", ";
out << vector.back() << " }"; out += toString(vector.back()) + " }";
return out; return out;
} }
} // namespace std };
} // namespace doctest
TEST_CASE("sf::Transform class - [graphics]") TEST_CASE("sf::Transform class - [graphics]")
{ {