diff --git a/doc/changelog.dox b/doc/changelog.dox index 8545120ea..a348e3b6c 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -40,6 +40,8 @@ See also: @subsection changelog-latest-new New features +- New @ref NoAllocate constructor tag, to be used by the @ref Vk library + @subsubsection changelog-latest-new-debugtools DebugTools library - Added @ref DebugTools::ColorMap::coolWarmSmooth() and diff --git a/src/Magnum/Tags.h b/src/Magnum/Tags.h index 22e506ad3..7138d0c9b 100644 --- a/src/Magnum/Tags.h +++ b/src/Magnum/Tags.h @@ -53,6 +53,21 @@ Vulkan / ... object. */ typedef Corrade::Containers::NoCreateT NoCreateT; +/** +@brief No allocation tag type +@m_since_latest + +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{}; + constexpr explicit NoAllocateT(Init) {} + #endif +}; + /** @brief No initialization tag @m_since{2020,06} @@ -80,6 +95,14 @@ constexpr NoCreateT NoCreate{}; using Corrade::Containers::NoCreate; #endif +/** +@brief No allocation tag +@m_since_latest + +Use for construction without allocating memory. +*/ +constexpr NoAllocateT NoAllocate{NoAllocateT::Init{}}; + } #endif diff --git a/src/Magnum/Test/TagsTest.cpp b/src/Magnum/Test/TagsTest.cpp index c742b13ba..9e8c6dc41 100644 --- a/src/Magnum/Test/TagsTest.cpp +++ b/src/Magnum/Test/TagsTest.cpp @@ -45,11 +45,13 @@ TagsTest::TagsTest() { void TagsTest::noDefaultConstructor() { CORRADE_VERIFY(!std::is_default_constructible::value); CORRADE_VERIFY(!std::is_default_constructible::value); + CORRADE_VERIFY(!std::is_default_constructible::value); } void TagsTest::inlineDefinition() { CORRADE_VERIFY((std::is_same::value)); CORRADE_VERIFY((std::is_same::value)); + CORRADE_VERIFY((std::is_same::value)); } }}}