From d75adc68724740711df5ea3eec97f6b27485e246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 9 Jul 2022 12:19:27 +0200 Subject: [PATCH] Cleanup and improve comments for various tag definitions. --- src/Magnum/Tags.h | 4 ++-- src/Magnum/Test/TagsTest.cpp | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Magnum/Tags.h b/src/Magnum/Tags.h index d03446574..7725ad848 100644 --- a/src/Magnum/Tags.h +++ b/src/Magnum/Tags.h @@ -83,10 +83,10 @@ using Corrade::NoCreateT; Used to distinguish construction without allocating memory. @see @ref NoAllocate */ -/* Explicit constructor to avoid ambiguous calls when using {} */ struct NoAllocateT { #ifndef DOXYGEN_GENERATING_OUTPUT - struct Init{}; + struct Init {}; + /* Explicit constructor to avoid ambiguous calls when using {} */ constexpr explicit NoAllocateT(Init) {} #endif }; diff --git a/src/Magnum/Test/TagsTest.cpp b/src/Magnum/Test/TagsTest.cpp index 0fd60736c..5c19b7eb7 100644 --- a/src/Magnum/Test/TagsTest.cpp +++ b/src/Magnum/Test/TagsTest.cpp @@ -43,12 +43,15 @@ TagsTest::TagsTest() { } void TagsTest::noDefaultConstructor() { + /* Isn't default constructible to prevent ambiguity when calling + foo({}) if both foo(TagT) and foo(whatever) is available */ CORRADE_VERIFY(!std::is_default_constructible::value); CORRADE_VERIFY(!std::is_default_constructible::value); CORRADE_VERIFY(!std::is_default_constructible::value); } void TagsTest::inlineDefinition() { + /* Just a sanity check that the types match */ CORRADE_VERIFY(std::is_same::value); CORRADE_VERIFY(std::is_same::value); CORRADE_VERIFY(std::is_same::value);