summaryrefslogtreecommitdiffstats
path: root/src/Vector3.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-05-04 20:21:48 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-07-23 01:32:47 +0200
commit330626ab22fe2e87afa5306c5f4039088c41b49e (patch)
tree86a5c7e0f0eb34743d186cbd712d368fed16f748 /src/Vector3.h
parentRemove some unused inclusions (diff)
downloadcuberite-330626ab22fe2e87afa5306c5f4039088c41b49e.tar
cuberite-330626ab22fe2e87afa5306c5f4039088c41b49e.tar.gz
cuberite-330626ab22fe2e87afa5306c5f4039088c41b49e.tar.bz2
cuberite-330626ab22fe2e87afa5306c5f4039088c41b49e.tar.lz
cuberite-330626ab22fe2e87afa5306c5f4039088c41b49e.tar.xz
cuberite-330626ab22fe2e87afa5306c5f4039088c41b49e.tar.zst
cuberite-330626ab22fe2e87afa5306c5f4039088c41b49e.zip
Diffstat (limited to '')
-rw-r--r--src/Vector3.h13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/Vector3.h b/src/Vector3.h
index 05c9c66de..0c7008763 100644
--- a/src/Vector3.h
+++ b/src/Vector3.h
@@ -400,26 +400,25 @@ public:
-namespace fmt
-{
+/** Allows formatting a Vector<T> using the same format specifiers as for T
+e.g. `fmt::format("{0:0.2f}", Vector3f{0.0231f, 1.2146f, 1.0f}) == "{0.02, 1.21, 1.00}"` */
template <typename What>
-class formatter<Vector3<What>>:
- public fmt::formatter<What>
+class fmt::formatter<Vector3<What>> : public fmt::formatter<What>
{
using Super = fmt::formatter<What>;
template <typename FormatContext, size_t Len>
void Write(FormatContext & a_Ctx, const char (& a_Str)[Len])
{
- auto Itr = std::copy_n(&a_Str[0], Len - 1, a_Ctx.out());
+ const auto Itr = std::copy_n(&a_Str[0], Len - 1, a_Ctx.out());
a_Ctx.advance_to(Itr);
}
template <typename FormatContext>
void Write(FormatContext & a_Ctx, const What & a_Arg)
{
- auto Itr = Super::format(a_Arg, a_Ctx);
+ const auto Itr = Super::format(a_Arg, a_Ctx);
a_Ctx.advance_to(Itr);
}
@@ -440,8 +439,6 @@ public:
}
};
-}
-