Browse Source

Cleanup and improve comments for various tag definitions.

pull/578/head
Vladimír Vondruš 4 years ago
parent
commit
d75adc6872
  1. 4
      src/Magnum/Tags.h
  2. 3
      src/Magnum/Test/TagsTest.cpp

4
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
};

3
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<NoInitT>::value);
CORRADE_VERIFY(!std::is_default_constructible<NoCreateT>::value);
CORRADE_VERIFY(!std::is_default_constructible<NoAllocateT>::value);
}
void TagsTest::inlineDefinition() {
/* Just a sanity check that the types match */
CORRADE_VERIFY(std::is_same<decltype(NoInit), const NoInitT>::value);
CORRADE_VERIFY(std::is_same<decltype(NoCreate), const NoCreateT>::value);
CORRADE_VERIFY(std::is_same<decltype(NoAllocate), const NoAllocateT>::value);

Loading…
Cancel
Save