From c0267de60b5c917f5f710b65a73b1fcf35edc86d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 29 Apr 2021 14:08:04 +0200 Subject: [PATCH] Move the initialization and creation tags to the root namespace. This was done for Magnum already and it's just a lot of unnecessary typing. Given that the containers may eventually get moved there as well, this makes sense. Unfortunately to avoid the deprecation warnings I had to prefix all current uses in the Containers library by Corrade::. Ugly, but temporary only since the aliases get removed. --- doc/corrade-changelog-old.dox | 10 +- doc/corrade-changelog.dox | 31 +- doc/namespaces.dox | 6 +- doc/snippets/Containers.cpp | 34 +-- src/Corrade/CMakeLists.txt | 3 +- src/Corrade/Containers/Array.h | 21 +- src/Corrade/Containers/ArrayTuple.h | 8 +- src/Corrade/Containers/BigEnumSet.h | 2 +- src/Corrade/Containers/CMakeLists.txt | 7 +- src/Corrade/Containers/EnumSet.h | 4 +- src/Corrade/Containers/GrowableArray.h | 96 +++--- src/Corrade/Containers/Optional.h | 6 +- src/Corrade/Containers/Pointer.h | 6 +- src/Corrade/Containers/ScopeGuard.h | 4 +- src/Corrade/Containers/StaticArray.h | 29 +- src/Corrade/Containers/StridedArrayView.h | 12 +- src/Corrade/Containers/String.cpp | 12 +- src/Corrade/Containers/String.h | 8 +- src/Corrade/Containers/StringView.cpp | 4 +- src/Corrade/Containers/Tags.h | 151 +--------- .../Containers/Test/ArrayStlSpanTest.cpp | 4 +- src/Corrade/Containers/Test/ArrayTest.cpp | 50 ++-- .../Containers/Test/ArrayTupleTest.cpp | 8 +- .../Containers/Test/BigEnumSetTest.cpp | 2 +- src/Corrade/Containers/Test/CMakeLists.txt | 2 - src/Corrade/Containers/Test/EnumSetTest.cpp | 2 +- .../Containers/Test/GrowableArrayTest.cpp | 116 ++++---- src/Corrade/Containers/Test/OptionalTest.cpp | 42 +-- src/Corrade/Containers/Test/PointerTest.cpp | 32 +- .../Containers/Test/ScopeGuardTest.cpp | 6 +- .../Containers/Test/StaticArrayTest.cpp | 48 +-- .../Containers/Test/StridedArrayViewTest.cpp | 14 +- src/Corrade/Containers/Test/StringTest.cpp | 18 +- src/Corrade/CorradeMain.cpp | 2 +- src/Corrade/Interconnect/Test/Benchmark.cpp | 8 +- src/Corrade/PluginManager/AbstractManager.cpp | 4 +- src/Corrade/PluginManager/AbstractPlugin.cpp | 6 +- .../PluginManager/Test/ManagerTest.cpp | 2 +- src/Corrade/Tags.h | 274 ++++++++++++++++++ src/Corrade/Test/CMakeLists.txt | 2 + .../{Containers => }/Test/TagsTest.cpp | 8 +- .../TestSuite/Compare/Test/ContainerTest.cpp | 6 +- src/Corrade/TestSuite/Test/TesterTest.cpp | 2 +- src/Corrade/TestSuite/Tester.cpp | 2 +- src/Corrade/Utility/Arguments.cpp | 28 +- src/Corrade/Utility/Test/AlgorithmsTest.cpp | 24 +- src/Corrade/Utility/Test/DirectoryTest.cpp | 10 +- 47 files changed, 662 insertions(+), 514 deletions(-) create mode 100644 src/Corrade/Tags.h rename src/Corrade/{Containers => }/Test/TagsTest.cpp (93%) diff --git a/doc/corrade-changelog-old.dox b/doc/corrade-changelog-old.dox index d026fafe4..186f26af0 100644 --- a/doc/corrade-changelog-old.dox +++ b/doc/corrade-changelog-old.dox @@ -177,10 +177,10 @@ a high-level overview. but with compile-time size information - New @ref Containers::Optional class, providing a subset of functionality from C++17 @ref std::optional (see [mosra/corrade#36](https://github.com/mosra/corrade/pull/36)) -- Added @ref Containers::NoInit, @ref Containers::DirectInit, - @ref Containers::DefaultInit, @ref Containers::ValueInit and - @ref Containers::InPlaceInit tags for better control over initialization of - @ref Containers::Array and @ref Containers::StaticArray +- Added @cpp Containers::NoInit @ce, @cpp Containers::DirectInit @ce, + @cpp Containers::DefaultInit @ce, @cpp Containers::ValueInit @ce and + @cpp Containers::InPlaceInit @ce tags for better control over + initialization of @ref Containers::Array and @ref Containers::StaticArray - Added @ref Containers::Array::Array(InPlaceInitT, std::initializer_list) to create @ref Containers::Array from an initializer list - New @ref Containers::Array::Array(T*, std::size_t, D) "Containers::Array::Array(T*, std::size_t, D)" @@ -264,7 +264,7 @@ a high-level overview. @subsubsection corrade-changelog-2018-02-changes-containers Containers library -- @ref Containers::EnumSet now can take a @ref Containers::NoInit tag to +- @ref Containers::EnumSet now can take a @cpp Containers::NoInit @ce tag to create an uninitialized value - Exposed @ref Containers::EnumSet::FullValue constant diff --git a/doc/corrade-changelog.dox b/doc/corrade-changelog.dox index 030783675..4d708ac5a 100644 --- a/doc/corrade-changelog.dox +++ b/doc/corrade-changelog.dox @@ -69,9 +69,8 @@ namespace Corrade { - New @ref Containers::Array2, @ref Containers::Array3 and @ref Containers::Array4 convenience aliases for @ref Containers::StaticArray, together with @ref Containers::Array1 that's - useful in case you want to take advantage of the @ref Containers::NoInit - tag on an arbitrary type and @ref Containers::Optional doesn't suit the use - case. + useful in case you want to take advantage of the @ref NoInit tag on an + arbitrary type and @ref Containers::Optional doesn't suit the use case. - New @ref Containers::ArrayView2, @ref Containers::ArrayView3 and @ref Containers::ArrayView4 convenience aliases for @ref Containers::StaticArrayView @@ -106,8 +105,8 @@ namespace Corrade { - @ref Containers::Array::Array(InPlaceInitT, std::initializer_list) constructor is no longer @cpp explicit @ce to allow for easier use in initializer lists -- @ref Containers::ScopeGuard now has a @ref Containers::NoCreate constructor - and is movable in order to support deferred creation +- @ref Containers::ScopeGuard now has a @ref NoCreate constructor and is + movable in order to support deferred creation - @ref Containers::LinkedList destruction was changed in a way that makes @ref Containers::LinkedListItem::list() still accessible in a destructor of @ref Containers::LinkedListItem subclasses @@ -241,6 +240,14 @@ namespace Corrade { however you'll get a deprecation notice. Since the variable got saved to CMake cache, to get rid of the message, you may need to either recreate your build directory or explicitly delete it from the cache. +- The @cpp Corrade/Containers/Tags.h @ce header, + @cpp Containers::DefaultInit @ce, @cpp Containers::ValueInit @ce, + @cpp Containers::NoInit @ce, @cpp Containers::NoCreate @ce, + @cpp Containers::DirectInit @ce, @cpp Containers::InPlaceInit @ce and + related tag types were moved to @ref Corrade/Tags.h and the root + @ref Corrade namespace, available as @ref DefaultInit, @ref ValueInit, + @ref NoInit, @ref NoCreate, @ref DirectInit, @ref InPlaceInit and related + tag types @subsection corrade-changelog-latest-compatibility Potential compatibility breakages, removed APIs @@ -529,12 +536,12 @@ Released 2020-06-27, tagged as compile when used with an empty argument list. The original functionality is provided by @ref CORRADE_INTERNAL_ASSERT_UNREACHABLE() instead. - @ref Containers::Array and @ref Containers::StaticArray was switched to - do the @ref Containers::ValueInit construction by default instead of - @ref Containers::DefaultInit, i.e. zero-initializing trivial types instead - of keeping them uninitialized. Apart from introducing potential slowdowns - due to the additional zero-ininitialization this isn't really breaking, - just makes the default safer; and you still have the option to choose a - different initialization. + do the @cpp Containers::ValueInit @ce construction by default instead of + @cpp Containers::DefaultInit @ce, i.e. zero-initializing trivial types + instead of keeping them uninitialized. Apart from introducing potential + slowdowns due to the additional zero-ininitialization this isn't really + breaking, just makes the default safer; and you still have the option to + choose a different initialization. - @ref Utility::Debug and @ref Utility::format() now prints @cpp long double @ce with 15 significant digits instead of 18 on platforms where it is 64-bit instead of 80-bit @@ -1002,7 +1009,7 @@ Released 2019-02-04, tagged as @ref std::unique_ptr - New @ref Containers::Reference class, a lightweight equivalent to @ref std::reference_wrapper -- New @ref Containers::NoCreate tag for constructing instances +- New @cpp Containers::NoCreate @ce tag for constructing instances equivalent to a moved-from state. This tag was used in Magnum already, moving it here to make it available to a wider set of APIs. - New @ref Containers::optional(Args&&... args) overload for in-place diff --git a/doc/namespaces.dox b/doc/namespaces.dox index 7f6ad0190..684d3d164 100644 --- a/doc/namespaces.dox +++ b/doc/namespaces.dox @@ -31,9 +31,9 @@ @brief Root namespace THe root namespace alone doesn't contain any functionality except for the -@ref Corrade/Corrade.h header, see subnamespaces for more information. To use -the base from CMake, request the `Corrade` package and link to the -`Corrade::Corrade` target: +@ref Corrade/Corrade.h and @ref Corrade/Tags.h headers, see subnamespaces for +more information. To use the base from CMake, request the `Corrade` package and +link to the `Corrade::Corrade` target: @code{.cmake} find_package(Corrade REQUIRED) diff --git a/doc/snippets/Containers.cpp b/doc/snippets/Containers.cpp index 9b20a5bc3..814521ba9 100644 --- a/doc/snippets/Containers.cpp +++ b/doc/snippets/Containers.cpp @@ -230,20 +230,20 @@ c[3] = 25; // c == {3, 18, -157, 25} /* [Array-usage-initialization] */ /* These two are equivalent */ Containers::Array a1{5}; -Containers::Array a2{Containers::ValueInit, 5}; +Containers::Array a2{ValueInit, 5}; /* Array of 100 integers, uninitialized */ -Containers::Array b{Containers::NoInit, 100}; +Containers::Array b{NoInit, 100}; /* Array of a type with no default constructor. All five elements will be initialized to {5.2f, 0.5f, 1.0f}. */ struct Vec3 { explicit Vec3(float, float, float) {} }; -Containers::Array c{Containers::DirectInit, 5, 5.2f, 0.4f, 1.0f}; +Containers::Array c{DirectInit, 5, 5.2f, 0.4f, 1.0f}; /* Array from an initializer list. These two are equivalent. */ -Containers::Array d1{Containers::InPlaceInit, {1, 2, 3, 4, -5, 0, 42}}; +Containers::Array d1{InPlaceInit, {1, 2, 3, 4, -5, 0, 42}}; auto d2 = Containers::array({1, 2, 3, 4, -5, 0, 42}); /* [Array-usage-initialization] */ } @@ -321,7 +321,7 @@ struct Foo { explicit Foo(int) {} }; -Containers::Array e{Containers::NoInit, 5}; +Containers::Array e{NoInit, 5}; int index = 0; for(Foo& f: e) new(&f) Foo{index++}; @@ -539,8 +539,8 @@ static_cast(info); Containers::ArrayView strings; Containers::ArrayView> references; Containers::ArrayTuple data{ - {Containers::ValueInit, 15, strings}, - {Containers::NoInit, 15, references} + {ValueInit, 15, strings}, + {NoInit, 15, references} }; /* Initialize all references to point to the strings */ @@ -555,8 +555,8 @@ for(std::size_t i = 0; i != strings.size(); ++i) Containers::ArrayView latencies; Containers::ArrayView averages; Containers::ArrayTuple data{ - {{Containers::NoInit, 200*1024*1024, latencies}, - {Containers::NoInit, 200*1024*1024, averages}}, + {{NoInit, 200*1024*1024, latencies}, + {NoInit, 200*1024*1024, averages}}, [](std::size_t size, std::size_t) -> std::pair { @@ -733,7 +733,7 @@ auto b = Containers::optional(value); { /* [optional-inplace] */ -auto a = Containers::Optional{Containers::InPlaceInit, 'a', 'b'}; +auto a = Containers::Optional{InPlaceInit, 'a', 'b'}; auto b = Containers::optional('a', 'b'); /* [optional-inplace] */ } @@ -749,7 +749,7 @@ auto b = Containers::optional('a', 'b'); { Containers::StringView filename; /* [ScopeGuard-deferred] */ -Containers::ScopeGuard e{Containers::NoCreate}; +Containers::ScopeGuard e{NoCreate}; /* Read from stdin if desired, otherwise scope-guard an opened file */ int fd; @@ -815,21 +815,21 @@ c[3] = 25; // c == {3, 18, -157, 25} /* [StaticArray-usage-initialization] */ /* These two are equivalent */ Containers::StaticArray<5, int> a1; -Containers::StaticArray<5, int> a2{Containers::DefaultInit}; +Containers::StaticArray<5, int> a2{DefaultInit}; /* Array of 100 integers, uninitialized */ -Containers::StaticArray<100, int> b{Containers::NoInit}; +Containers::StaticArray<100, int> b{NoInit}; /* Array of 4 values initialized in-place. These two are equivalent. */ Containers::StaticArray<4, int> c1{3, 18, -157, 0}; -Containers::StaticArray<4, int> c2{Containers::InPlaceInit, 3, 18, -157, 0}; +Containers::StaticArray<4, int> c2{InPlaceInit, 3, 18, -157, 0}; /* Array of a type with no default constructor. All five elements will be initialized to {5.2f, 0.5f, 1.0f}. */ struct Vec3 { explicit Vec3(float, float, float) {} }; -Containers::StaticArray<5, Vec3> d{Containers::DirectInit, 5.2f, 0.4f, 1.0f}; +Containers::StaticArray<5, Vec3> d{DirectInit, 5.2f, 0.4f, 1.0f}; /* [StaticArray-usage-initialization] */ } @@ -839,7 +839,7 @@ struct Foo { explicit Foo(int) {} }; -Containers::StaticArray<5, Foo> e{Containers::NoInit}; +Containers::StaticArray<5, Foo> e{NoInit}; int index = 0; for(Foo& f: e) new(&f) Foo{index++}; @@ -1076,7 +1076,7 @@ auto b = Containers::pointer(ptr); { /* [pointer-inplace] */ -auto a = Containers::Pointer{Containers::InPlaceInit, 'a', 'b'}; +auto a = Containers::Pointer{InPlaceInit, 'a', 'b'}; auto b = Containers::pointer('a', 'b'); /* [pointer-inplace] */ } diff --git a/src/Corrade/CMakeLists.txt b/src/Corrade/CMakeLists.txt index 5b0e498d5..84630307d 100644 --- a/src/Corrade/CMakeLists.txt +++ b/src/Corrade/CMakeLists.txt @@ -63,7 +63,8 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/version.h) set(Corrade_HEADERS - Corrade.h) + Corrade.h + Tags.h) # Force IDEs to display all header files in project view add_custom_target(Corrade SOURCES ${Corrade_HEADERS}) diff --git a/src/Corrade/Containers/Array.h b/src/Corrade/Containers/Array.h index 53095bbbe..75132dd0f 100644 --- a/src/Corrade/Containers/Array.h +++ b/src/Corrade/Containers/Array.h @@ -35,9 +35,8 @@ #include #include -#include "Corrade/configure.h" +#include "Corrade/Tags.h" #include "Corrade/Containers/ArrayView.h" -#include "Corrade/Containers/Tags.h" #include "Corrade/Containers/constructHelpers.h" namespace Corrade { namespace Containers { @@ -334,7 +333,7 @@ class Array { * @ref Array(NoInitT, std::size_t) variant instead. * @see @ref DefaultInit, @ref std::is_trivial */ - explicit Array(DefaultInitT, std::size_t size): _data{size ? new T[size] : nullptr}, _size{size}, _deleter{nullptr} {} + explicit Array(Corrade::DefaultInitT, std::size_t size): _data{size ? new T[size] : nullptr}, _size{size}, _deleter{nullptr} {} /** * @brief Construct a value-initialized array @@ -345,7 +344,7 @@ class Array { * is zero, no allocation is done. * @see @ref ValueInit, @ref Array(DefaultInitT, std::size_t) */ - explicit Array(ValueInitT, std::size_t size): _data{size ? new T[size]() : nullptr}, _size{size}, _deleter{nullptr} {} + explicit Array(Corrade::ValueInitT, std::size_t size): _data{size ? new T[size]() : nullptr}, _size{size}, _deleter{nullptr} {} /** * @brief Construct an array without initializing its contents @@ -373,7 +372,7 @@ class Array { * @ref array(std::initializer_list), @ref deleter(), * @ref std::is_trivial */ - explicit Array(NoInitT, std::size_t size): _data{size ? Implementation::noInitAllocate(size) : nullptr}, _size{size}, _deleter{Implementation::noInitDeleter()} {} + explicit Array(Corrade::NoInitT, std::size_t size): _data{size ? Implementation::noInitAllocate(size) : nullptr}, _size{size}, _deleter{Implementation::noInitDeleter()} {} /** * @brief Construct a direct-initialized array @@ -382,7 +381,7 @@ class Array { * constructor and then initializes each element with placement new * using forwarded @p args. */ - template explicit Array(DirectInitT, std::size_t size, Args&&... args); + template explicit Array(Corrade::DirectInitT, std::size_t size, Args&&... args); /** * @brief Construct a list-initialized array @@ -397,7 +396,7 @@ class Array { * @ref Containers-Array-initializer-list "class documentation" for * more information. */ - /*implicit*/ Array(InPlaceInitT, std::initializer_list list); + /*implicit*/ Array(Corrade::InPlaceInitT, std::initializer_list list); /** * @brief Construct a value-initialized array @@ -405,7 +404,7 @@ class Array { * Alias to @ref Array(ValueInitT, std::size_t). * @see @ref Array(DefaultInitT, std::size_t) */ - explicit Array(std::size_t size): Array{ValueInit, size} {} + explicit Array(std::size_t size): Array{Corrade::ValueInit, size} {} /** * @brief Wrap an existing array @@ -694,7 +693,7 @@ usability issues as with @ref std::vector --- see the information. */ template inline Array array(std::initializer_list list) { - return Array{InPlaceInit, list}; + return Array{Corrade::InPlaceInit, list}; } /** @relatesalso ArrayView @@ -750,7 +749,7 @@ template inline Array::Array(Array&& other) noexce other._deleter = D{}; } -template template Array::Array(DirectInitT, std::size_t size, Args&&... args): Array{NoInit, size} { +template template Array::Array(Corrade::DirectInitT, std::size_t size, Args&&... args): Array{Corrade::NoInit, size} { for(std::size_t i = 0; i != size; ++i) /* This works around a featurebug in C++ where new T{} doesn't work for an explicit defaulted constructor. Additionally it works around GCC @@ -759,7 +758,7 @@ template template Array::Array(DirectInit Implementation::construct(_data[i], std::forward(args)...); } -template Array::Array(InPlaceInitT, std::initializer_list list): Array{NoInit, list.size()} { +template Array::Array(Corrade::InPlaceInitT, std::initializer_list list): Array{Corrade::NoInit, list.size()} { std::size_t i = 0; for(const T& item: list) /* Can't use {}, see the GCC 4.8-specific overload for details */ diff --git a/src/Corrade/Containers/ArrayTuple.h b/src/Corrade/Containers/ArrayTuple.h index eb7df0190..7ac7610a9 100644 --- a/src/Corrade/Containers/ArrayTuple.h +++ b/src/Corrade/Containers/ArrayTuple.h @@ -34,9 +34,9 @@ #include #include +#include "Corrade/Tags.h" #include "Corrade/Containers/Containers.h" #include "Corrade/Containers/constructHelpers.h" -#include "Corrade/Containers/Tags.h" #include "Corrade/Utility/visibility.h" namespace Corrade { namespace Containers { @@ -288,7 +288,7 @@ class ArrayTuple::Item { * use @ref Item(NoInitT, std::size_t, ArrayView&) instead and then * manually construct each item in-place. */ - template /*implicit*/ Item(ValueInitT, std::size_t size, ArrayView& outputView): Item{NoInit, size, outputView} { + template /*implicit*/ Item(Corrade::ValueInitT, std::size_t size, ArrayView& outputView): Item{Corrade::NoInit, size, outputView} { static_assert(std::is_default_constructible::value, "can't default-init a type with no default constructor, use NoInit instead and manually initialize each item"); _constructor = [](void* data) { @@ -303,7 +303,7 @@ class ArrayTuple::Item { * * Alias to @ref Item(ValueInitT, std::size_t, ArrayView&). */ - template /*implicit*/ Item(std::size_t size, ArrayView& outputView): Item{ValueInit, size, outputView} {} + template /*implicit*/ Item(std::size_t size, ArrayView& outputView): Item{Corrade::ValueInit, size, outputView} {} /** * @brief Construct a view without initializing its elements @@ -317,7 +317,7 @@ class ArrayTuple::Item { * gets finally called on *all elements*, regardless of whether they * were properly constructed or not. */ - template /*implicit*/ Item(NoInitT, std::size_t size, ArrayView& outputView): + template /*implicit*/ Item(Corrade::NoInitT, std::size_t size, ArrayView& outputView): _elementSize{sizeof(T)}, _elementAlignment{alignof(T)}, _elementCount{size}, _constructor{}, _destructor{std::is_trivially_destructible::value ? static_cast(nullptr) : diff --git a/src/Corrade/Containers/BigEnumSet.h b/src/Corrade/Containers/BigEnumSet.h index 96e86bc42..073b92324 100644 --- a/src/Corrade/Containers/BigEnumSet.h +++ b/src/Corrade/Containers/BigEnumSet.h @@ -120,7 +120,7 @@ class BigEnumSet { * * The contents are left in an undefined state. */ - explicit BigEnumSet(NoInitT) {} + explicit BigEnumSet(Corrade::NoInitT) {} /** @brief Equality comparison */ constexpr bool operator==(const BigEnumSet& other) const { diff --git a/src/Corrade/Containers/CMakeLists.txt b/src/Corrade/Containers/CMakeLists.txt index 285f7bf91..3647d3f6f 100644 --- a/src/Corrade/Containers/CMakeLists.txt +++ b/src/Corrade/Containers/CMakeLists.txt @@ -51,12 +51,15 @@ set(CorradeContainers_HEADERS StridedArrayView.h String.h StringStl.h - StringView.h - Tags.h) + StringView.h) set(CorradeContainers_PRIVATE_HEADERS Implementation/RawForwardList.h) +if(CORRADE_BUILD_DEPRECATED) + list(APPEND CorradeContainers_HEADERS Tags.h) +endif() + # Sources are compiled as part of Utility # Force IDEs to display all header files in project view diff --git a/src/Corrade/Containers/EnumSet.h b/src/Corrade/Containers/EnumSet.h index 67d5d6fe7..0776c97c1 100644 --- a/src/Corrade/Containers/EnumSet.h +++ b/src/Corrade/Containers/EnumSet.h @@ -33,8 +33,8 @@ #include +#include "Corrade/Tags.h" #include "Corrade/Containers/Containers.h" /* for template default args */ -#include "Corrade/Containers/Tags.h" namespace Corrade { namespace Containers { @@ -110,7 +110,7 @@ class EnumSet { * * The contents are left in an undefined state. */ - explicit EnumSet(NoInitT) {} + explicit EnumSet(Corrade::NoInitT) {} /** @brief Equality comparison */ constexpr bool operator==(EnumSet other) const { diff --git a/src/Corrade/Containers/GrowableArray.h b/src/Corrade/Containers/GrowableArray.h index ab0451f74..8342e9252 100644 --- a/src/Corrade/Containers/GrowableArray.h +++ b/src/Corrade/Containers/GrowableArray.h @@ -521,7 +521,7 @@ size. @see @ref arrayCapacity(), @ref arrayIsGrowable(), @ref arrayRemoveSuffix() @ref Containers-Array-growable */ -template> void arrayResize(Array& array, DefaultInitT, std::size_t size); +template> void arrayResize(Array& array, Corrade::DefaultInitT, std::size_t size); /* This crap tool can't distinguish between this and above overload, showing just one with the docs melted together. More useless than showing nothing @@ -534,8 +534,8 @@ template> void arrayResize(Array Convenience overload allowing to specify just the allocator template, with array type being inferred. */ -template class Allocator, class T> inline void arrayResize(Array& array, DefaultInitT, std::size_t size) { - arrayResize>(array, DefaultInit, size); +template class Allocator, class T> inline void arrayResize(Array& array, Corrade::DefaultInitT, std::size_t size) { + arrayResize>(array, Corrade::DefaultInit, size); } #endif @@ -549,7 +549,7 @@ the new elements at the end are not default-initialized, but value-initialized otherwise). @see @ref Array::size(), @ref arrayIsGrowable(), @ref Containers-Array-growable */ -template> void arrayResize(Array& array, ValueInitT, std::size_t size); +template> void arrayResize(Array& array, Corrade::ValueInitT, std::size_t size); /* This crap tool can't distinguish between this and above overload, showing just one with the docs melted together. More useless than showing nothing @@ -562,8 +562,8 @@ template> void arrayResize(Array Convenience overload allowing to specify just the allocator template, with array type being inferred. */ -template class Allocator, class T> inline void arrayResize(Array& array, ValueInitT, std::size_t size) { - arrayResize>(array, ValueInit, size); +template class Allocator, class T> inline void arrayResize(Array& array, Corrade::ValueInitT, std::size_t size) { + arrayResize>(array, Corrade::ValueInit, size); } #endif @@ -574,7 +574,7 @@ template class Allocator, class T> inline void arrayResize(Array Alias to @ref arrayResize(Array&, ValueInitT, std::size_t). */ template> inline void arrayResize(Array& array, std::size_t size) { - return arrayResize(array, ValueInit, size); + return arrayResize(array, Corrade::ValueInit, size); } /* This crap tool can't distinguish between this and above overload, showing @@ -603,7 +603,7 @@ uninitialized state instead. @see @ref Array::size(), @ref arrayIsGrowable(), @ref Containers-Array-growable, @ref arrayAppend(Array&, NoInitT, std::size_t) */ -template> void arrayResize(Array& array, NoInitT, std::size_t size); +template> void arrayResize(Array& array, Corrade::NoInitT, std::size_t size); /* This crap tool can't distinguish between this and above overload, showing just one with the docs melted together. More useless than showing nothing @@ -616,8 +616,8 @@ template> void arrayResize(Array Convenience overload allowing to specify just the allocator template, with array type being inferred. */ -template class Allocator, class T> inline void arrayResize(Array& array, NoInitT, std::size_t size) { - arrayResize>(array, NoInit, size); +template class Allocator, class T> inline void arrayResize(Array& array, Corrade::NoInitT, std::size_t size) { + arrayResize>(array, Corrade::NoInit, size); } #endif @@ -629,13 +629,13 @@ Similar to @ref arrayResize(Array&, DefaultInitT, std::size_t) except that the new elements at the end are constructed using placement-new with provided @p args. */ -template void arrayResize(Array& array, DirectInitT, std::size_t size, Args&&... args); +template void arrayResize(Array& array, Corrade::DirectInitT, std::size_t size, Args&&... args); /** @overload @m_since{2020,06} */ -template void arrayResize(Array& array, DirectInitT, std::size_t size, Args&&... args); +template void arrayResize(Array& array, Corrade::DirectInitT, std::size_t size, Args&&... args); /* This crap tool can't distinguish between this and above overload, showing just one with the docs melted together. More useless than showing nothing @@ -648,8 +648,8 @@ template void arrayResize(Array& arr Convenience overload allowing to specify just the allocator template, with array type being inferred. */ -template class Allocator, class T, class... Args> inline void arrayResize(Array& array, DirectInitT, std::size_t size, Args&&... args) { - arrayResize>(array, DirectInit, size, std::forward(args)...); +template class Allocator, class T, class... Args> inline void arrayResize(Array& array, Corrade::DirectInitT, std::size_t size, Args&&... args) { + arrayResize>(array, Corrade::DirectInit, size, std::forward(args)...); } #endif @@ -691,7 +691,7 @@ template class Allocator, class T> inline T& arrayAppend(Array&, const T&) except that the new element is constructed using placement-new with provided @p args. */ -template T& arrayAppend(Array& array, InPlaceInitT, Args&&... args); +template T& arrayAppend(Array& array, Corrade::InPlaceInitT, Args&&... args); /* This crap tool can't distinguish between these and above overload, showing just one with the docs melted together. More useless than showing nothing @@ -701,7 +701,7 @@ template T& arrayAppend(Array& array, InPlaceInitT, A @overload @m_since{2020,06} */ -template T& arrayAppend(Array& array, InPlaceInitT, Args&&... args); +template T& arrayAppend(Array& array, Corrade::InPlaceInitT, Args&&... args); /** @overload @@ -710,8 +710,8 @@ template T& arrayAppend(Array& array Convenience overload allowing to specify just the allocator template, with array type being inferred. */ -template class Allocator, class T, class... Args> inline T& arrayAppend(Array& array, InPlaceInitT, Args&&... args) { - return arrayAppend>(array, InPlaceInit, std::forward(args)...); +template class Allocator, class T, class... Args> inline T& arrayAppend(Array& array, Corrade::InPlaceInitT, Args&&... args) { + return arrayAppend>(array, Corrade::InPlaceInit, std::forward(args)...); } #endif @@ -723,7 +723,7 @@ template class Allocator, class T, class... Args> inline T& arra Calls @ref arrayAppend(Array&, InPlaceInitT, Args&&... args) with @p value. */ template> inline T& arrayAppend(Array& array, T&& value) { - return arrayAppend(array, InPlaceInit, std::move(value)); + return arrayAppend(array, Corrade::InPlaceInit, std::move(value)); } /* This crap tool can't distinguish between this and above overload, showing @@ -738,7 +738,7 @@ Convenience overload allowing to specify just the allocator template, with array type being inferred. */ template class Allocator, class T> inline T& arrayAppend(Array& array, T&& value) { - return arrayAppend>(array, InPlaceInit, std::move(value)); + return arrayAppend>(array, Corrade::InPlaceInit, std::move(value)); } #endif @@ -800,7 +800,7 @@ A lower-level variant of @ref arrayAppend(Array& array, ArrayView) where the new values are meant to be initialized in-place after, instead of being copied from a pre-existing location. */ -template> ArrayView arrayAppend(Array& array, NoInitT, std::size_t count); +template> ArrayView arrayAppend(Array& array, Corrade::NoInitT, std::size_t count); /* This crap tool can't distinguish between this and above overload, showing just one with the docs melted together. More useless than showing nothing @@ -813,8 +813,8 @@ template> ArrayView arrayAppend( Convenience overload allowing to specify just the allocator template, with array type being inferred. */ -template class Allocator, class T> inline ArrayView arrayAppend(Array& array, NoInitT, std::size_t count) { - return arrayAppend>(array, NoInit, count); +template class Allocator, class T> inline ArrayView arrayAppend(Array& array, Corrade::NoInitT, std::size_t count) { + return arrayAppend>(array, Corrade::NoInit, count); } #endif @@ -860,7 +860,7 @@ Complexity is at most @f$ \mathcal{O}(n) @f$ in the size of the container, @see @ref arrayShrink(Array&, DefaultInitT), @ref arrayIsGrowable(), @ref Containers-Array-growable */ -template> void arrayShrink(Array& array, NoInitT = NoInit); +template> void arrayShrink(Array& array, Corrade::NoInitT = Corrade::NoInit); /** @brief Convert an array back to non-growable using a default initialization @@ -877,7 +877,7 @@ has a default (@cpp nullptr @ce) deleter. This is useful when it's not possible to use custom deleters, such as in plugin implementations. @see @ref arrayIsGrowable(), @ref Containers-Array-growable */ -template> void arrayShrink(Array& array, DefaultInitT); +template> void arrayShrink(Array& array, Corrade::DefaultInitT); /* This crap tool can't distinguish between this and above overload, showing just one with the docs melted together. More useless than showing nothing @@ -910,7 +910,7 @@ template struct ArrayGuts { void(*deleter)(T*, std::size_t); }; -template inline void arrayConstruct(DefaultInitT, T*, T*, typename std::enable_if< +template inline void arrayConstruct(Corrade::DefaultInitT, T*, T*, typename std::enable_if< #ifdef CORRADE_STD_IS_TRIVIALLY_TRAITS_SUPPORTED std::is_trivially_constructible::value #else @@ -920,7 +920,7 @@ template inline void arrayConstruct(DefaultInitT, T*, T*, typename std: /* Nothing to do */ } -template inline void arrayConstruct(DefaultInitT, T* begin, T* const end, typename std::enable_if inline void arrayConstruct(Corrade::DefaultInitT, T* begin, T* const end, typename std::enable_if::value #else @@ -932,7 +932,7 @@ template inline void arrayConstruct(DefaultInitT, T* begin, T* const en for(; begin < end; ++begin) new(begin) T; } -template inline void arrayConstruct(ValueInitT, T* const begin, T* const end, typename std::enable_if< +template inline void arrayConstruct(Corrade::ValueInitT, T* const begin, T* const end, typename std::enable_if< #ifdef CORRADE_STD_IS_TRIVIALLY_TRAITS_SUPPORTED std::is_trivially_constructible::value #else @@ -942,7 +942,7 @@ template inline void arrayConstruct(ValueInitT, T* const begin, T* cons if(begin < end) std::memset(begin, 0, (end - begin)*sizeof(T)); } -template inline void arrayConstruct(ValueInitT, T* begin, T* const end, typename std::enable_if inline void arrayConstruct(Corrade::ValueInitT, T* begin, T* const end, typename std::enable_if::value #else @@ -1150,7 +1150,7 @@ template std::size_t arrayReserve(Array& array, con return capacity; } -template void arrayResize(Array& array, NoInitT, const std::size_t size) { +template void arrayResize(Array& array, Corrade::NoInitT, const std::size_t size) { /* Direct access & value caching to speed up debug builds */ auto& arrayGuts = reinterpret_cast&>(array); const bool hasGrowingDeleter = arrayGuts.deleter == Allocator::deleter; @@ -1217,21 +1217,21 @@ template void arrayResize(Array& array, NoInitT, co } } -template void arrayResize(Array& array, DefaultInitT, const std::size_t size) { +template void arrayResize(Array& array, Corrade::DefaultInitT, const std::size_t size) { const std::size_t prevSize = array.size(); - arrayResize(array, NoInit, size); - Implementation::arrayConstruct(DefaultInit, array + prevSize, array.end()); + arrayResize(array, Corrade::NoInit, size); + Implementation::arrayConstruct(Corrade::DefaultInit, array + prevSize, array.end()); } -template void arrayResize(Array& array, ValueInitT, const std::size_t size) { +template void arrayResize(Array& array, Corrade::ValueInitT, const std::size_t size) { const std::size_t prevSize = array.size(); - arrayResize(array, NoInit, size); - Implementation::arrayConstruct(ValueInit, array + prevSize, array.end()); + arrayResize(array, Corrade::NoInit, size); + Implementation::arrayConstruct(Corrade::ValueInit, array + prevSize, array.end()); } -template void arrayResize(Array& array, DirectInitT, const std::size_t size, Args&&... args) { +template void arrayResize(Array& array, Corrade::DirectInitT, const std::size_t size, Args&&... args) { const std::size_t prevSize = array.size(); - arrayResize(array, NoInit, size); + arrayResize(array, Corrade::NoInit, size); /* In-place construct the new elements. No helper function for this as there's no way we could memcpy such a thing. */ @@ -1239,8 +1239,8 @@ template void arrayResize(Array& arr Implementation::construct(*it, std::forward(args)...); } -template inline void arrayResize(Array& array, DirectInitT, const std::size_t size, Args&&... args) { - arrayResize, Args...>(array, DirectInit, size, std::forward(args)...); +template inline void arrayResize(Array& array, Corrade::DirectInitT, const std::size_t size, Args&&... args) { + arrayResize, Args...>(array, Corrade::DirectInit, size, std::forward(args)...); } namespace Implementation { @@ -1325,15 +1325,15 @@ template inline ArrayView arrayAppend(Array& arr return {it, valueCount}; } -template inline T& arrayAppend(Array& array, InPlaceInitT, Args&&... args) { - return arrayAppend>(array, InPlaceInit, std::forward(args)...); +template inline T& arrayAppend(Array& array, Corrade::InPlaceInitT, Args&&... args) { + return arrayAppend>(array, Corrade::InPlaceInit, std::forward(args)...); } /* This crap tool can't distinguish between this and above overload, showing just one with the docs melted together. More useless than showing nothing at all, so hiding this one from it until it improves. */ #ifndef DOXYGEN_GENERATING_OUTPUT -template T& arrayAppend(Array& array, InPlaceInitT, Args&&... args) { +template T& arrayAppend(Array& array, Corrade::InPlaceInitT, Args&&... args) { T* const it = Implementation::arrayGrowBy(array, 1); /* No helper function as there's no way we could memcpy such a thing. */ /* On GCC 4.8 this includes another workaround, see the 4.8-specific @@ -1343,7 +1343,7 @@ template T& arrayAppend(Array& array } #endif -template ArrayView arrayAppend(Array& array, NoInitT, const std::size_t count) { +template ArrayView arrayAppend(Array& array, Corrade::NoInitT, const std::size_t count) { T* const it = Implementation::arrayGrowBy(array, count); return {it, count}; } @@ -1390,7 +1390,7 @@ template void arrayRemoveSuffix(Array& array, const } } -template void arrayShrink(Array& array, NoInitT) { +template void arrayShrink(Array& array, Corrade::NoInitT) { /* Direct access to speed up debug builds */ auto& arrayGuts = reinterpret_cast&>(array); @@ -1401,7 +1401,7 @@ template void arrayShrink(Array& array, NoInitT) { /* Even if we don't need to shrink, reallocating to an usual array with common deleters to avoid surprises */ - Array newArray{NoInit, arrayGuts.size}; + Array newArray{Corrade::NoInit, arrayGuts.size}; Implementation::arrayMoveConstruct(arrayGuts.data, newArray, arrayGuts.size); array = std::move(newArray); @@ -1410,7 +1410,7 @@ template void arrayShrink(Array& array, NoInitT) { #endif } -template void arrayShrink(Array& array, DefaultInitT) { +template void arrayShrink(Array& array, Corrade::DefaultInitT) { /* Direct access to speed up debug builds */ auto& arrayGuts = reinterpret_cast&>(array); @@ -1421,7 +1421,7 @@ template void arrayShrink(Array& array, DefaultInit /* Even if we don't need to shrink, reallocating to an usual array with common deleters to avoid surprises */ - Array newArray{DefaultInit, arrayGuts.size}; + Array newArray{Corrade::DefaultInit, arrayGuts.size}; Implementation::arrayMoveAssign(arrayGuts.data, newArray, arrayGuts.size); array = std::move(newArray); diff --git a/src/Corrade/Containers/Optional.h b/src/Corrade/Containers/Optional.h index cb17f8363..be17a00e5 100644 --- a/src/Corrade/Containers/Optional.h +++ b/src/Corrade/Containers/Optional.h @@ -35,7 +35,7 @@ #include #include -#include "Corrade/Containers/Tags.h" +#include "Corrade/Tags.h" #include "Corrade/Containers/constructHelpers.h" #include "Corrade/Utility/Assert.h" #ifndef CORRADE_NO_DEBUG @@ -163,7 +163,7 @@ template class Optional { * @see @ref operator bool(), @ref operator->(), @ref operator*(), * @ref emplace() */ - template /*implicit*/ Optional(InPlaceInitT, Args&&... args) noexcept(std::is_nothrow_constructible::value): _set{true} { + template /*implicit*/ Optional(Corrade::InPlaceInitT, Args&&... args) noexcept(std::is_nothrow_constructible::value): _set{true} { Implementation::construct(_value, std::forward(args)...); } @@ -445,7 +445,7 @@ The following two lines are equivalent: @see @ref optional(T&&), @ref pointer(Args&&... args) */ template inline Optional optional(Args&&... args) { - return Optional{InPlaceInit, std::forward(args)...}; + return Optional{Corrade::InPlaceInit, std::forward(args)...}; } /** @relatesalso Optional diff --git a/src/Corrade/Containers/Pointer.h b/src/Corrade/Containers/Pointer.h index 38b0a3200..05643bf08 100644 --- a/src/Corrade/Containers/Pointer.h +++ b/src/Corrade/Containers/Pointer.h @@ -34,7 +34,7 @@ #include #include /* std::forward() */ -#include "Corrade/Containers/Tags.h" +#include "Corrade/Tags.h" #include "Corrade/Utility/Assert.h" #ifndef CORRADE_NO_DEBUG #include "Corrade/Utility/Debug.h" @@ -133,7 +133,7 @@ template class Pointer { * Allocates a new object by passing @p args to its constructor. * @see @ref operator bool(), @ref operator->() */ - template explicit Pointer(InPlaceInitT, Args&&... args): _pointer{ + template explicit Pointer(Corrade::InPlaceInitT, Args&&... args): _pointer{ /* This works around a featurebug in C++ where new T{} doesn't work for an explicit defaulted constructor. Additionally it works around GCC 4.8 bugs where copy/move construction can't be done @@ -394,7 +394,7 @@ similar to @ref std::make_unique() from C++14. The following two lines are */ template inline Pointer pointer(Args&&... args) { static_assert(!Implementation::IsFirstAPointer::value || !std::is_constructible::value, "attempt to construct a type from its own pointer, which is ambiguous -- explicitly use the constructor instead"); - return Pointer{InPlaceInit, std::forward(args)...}; + return Pointer{Corrade::InPlaceInit, std::forward(args)...}; } #ifndef CORRADE_NO_DEBUG diff --git a/src/Corrade/Containers/ScopeGuard.h b/src/Corrade/Containers/ScopeGuard.h index 43ab3d0c7..58cd55fc3 100644 --- a/src/Corrade/Containers/ScopeGuard.h +++ b/src/Corrade/Containers/ScopeGuard.h @@ -32,7 +32,7 @@ #include -#include "Corrade/Containers/Tags.h" +#include "Corrade/Tags.h" namespace Corrade { namespace Containers { @@ -108,7 +108,7 @@ class ScopeGuard { * another object over it to make it useful. * @see @ref Containers-ScopeGuard-deferred */ - explicit ScopeGuard(NoCreateT) noexcept: _deleterWrapper{}, _deleter{}, _handle{} {} + explicit ScopeGuard(Corrade::NoCreateT) noexcept: _deleterWrapper{}, _deleter{}, _handle{} {} /** @brief Copying is not allowed */ ScopeGuard(const ScopeGuard&) = delete; diff --git a/src/Corrade/Containers/StaticArray.h b/src/Corrade/Containers/StaticArray.h index dd2271648..7acfd9415 100644 --- a/src/Corrade/Containers/StaticArray.h +++ b/src/Corrade/Containers/StaticArray.h @@ -34,9 +34,8 @@ #include #include -#include "Corrade/configure.h" +#include "Corrade/Tags.h" #include "Corrade/Containers/ArrayView.h" -#include "Corrade/Containers/Tags.h" #include "Corrade/Containers/constructHelpers.h" namespace Corrade { namespace Containers { @@ -160,7 +159,7 @@ template class StaticArray { * variant instead. * @see @ref DefaultInit, @ref std::is_trivial */ - explicit StaticArray(DefaultInitT): StaticArray{DefaultInit, std::integral_constant::value && std::is_trivial::value>{}} {} + explicit StaticArray(Corrade::DefaultInitT): StaticArray{Corrade::DefaultInit, std::integral_constant::value && std::is_trivial::value>{}} {} /** * @brief Construct a value-initialized array @@ -170,7 +169,7 @@ template class StaticArray { * called otherwise). This is the same as @ref StaticArray(). * @see @ref ValueInit, @ref StaticArray(DefaultInitT) */ - explicit StaticArray(ValueInitT): _data{} {} + explicit StaticArray(Corrade::ValueInitT): _data{} {} /** * @brief Construct an array without initializing its contents @@ -193,7 +192,7 @@ template class StaticArray { * @ref StaticArray(InPlaceInitT, Args&&... args), * @ref std::is_trivial */ - explicit StaticArray(NoInitT) {} + explicit StaticArray(Corrade::NoInitT) {} /** * @brief Construct a direct-initialized array @@ -203,7 +202,7 @@ template class StaticArray { * @p args. * @see @ref StaticArray(InPlaceInitT, Args&&... args) */ - template explicit StaticArray(DirectInitT, Args&&... args); + template explicit StaticArray(Corrade::DirectInitT, Args&&... args); /** * @brief Construct an in-place-initialized array @@ -212,7 +211,7 @@ template class StaticArray { * @ref StaticArray(Args&&... args). * @see @ref StaticArray(DirectInitT, Args&&... args) */ - template explicit StaticArray(InPlaceInitT, Args&&... args): _data{std::forward(args)...} { + template explicit StaticArray(Corrade::InPlaceInitT, Args&&... args): _data{std::forward(args)...} { static_assert(sizeof...(args) == size_, "Containers::StaticArray: wrong number of initializers"); } @@ -222,7 +221,7 @@ template class StaticArray { * Alias to @ref StaticArray(ValueInitT). * @see @ref StaticArray(DefaultInitT) */ - explicit StaticArray(): StaticArray{ValueInit} {} + explicit StaticArray(): StaticArray{Corrade::ValueInit} {} /** * @brief Construct an in-place-initialized array @@ -233,7 +232,7 @@ template class StaticArray { #ifdef DOXYGEN_GENERATING_OUTPUT template /*implicit*/ StaticArray(Args&&... args); #else - template::value>::type> /*implicit*/ StaticArray(First&& first, Next&&... next): StaticArray{InPlaceInit, std::forward(first), std::forward(next)...} {} + template::value>::type> /*implicit*/ StaticArray(First&& first, Next&&... next): StaticArray{Corrade::InPlaceInit, std::forward(first), std::forward(next)...} {} #endif /** @brief Copy constructor */ @@ -491,14 +490,14 @@ template class StaticArray { } private: - explicit StaticArray(DefaultInitT, std::true_type) {} + explicit StaticArray(Corrade::DefaultInitT, std::true_type) {} /* GCC 5.3 is not able to initialize non-movable types inside constructor initializer list. Reported here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70395 */ #if !defined(__GNUC__) || defined(__clang__) - explicit StaticArray(DefaultInitT, std::false_type): _data{} {} + explicit StaticArray(Corrade::DefaultInitT, std::false_type): _data{} {} #else - explicit StaticArray(DefaultInitT, std::false_type) { + explicit StaticArray(Corrade::DefaultInitT, std::false_type) { for(T& i: _data) new(&i) T{}; } #endif @@ -630,7 +629,7 @@ template constexpr std::size_t arraySize(const Stati return size_; } -template template StaticArray::StaticArray(DirectInitT, Args&&... args): StaticArray{NoInit} { +template template StaticArray::StaticArray(Corrade::DirectInitT, Args&&... args): StaticArray{Corrade::NoInit} { for(T& i: _data) /* This works around a featurebug in C++ where new T{} doesn't work for an explicit defaulted constructor. Additionally it works around GCC @@ -639,7 +638,7 @@ template template StaticArray(args)...); } -template StaticArray::StaticArray(const StaticArray& other) noexcept(std::is_nothrow_copy_constructible::value): StaticArray{NoInit} { +template StaticArray::StaticArray(const StaticArray& other) noexcept(std::is_nothrow_copy_constructible::value): StaticArray{Corrade::NoInit} { for(std::size_t i = 0; i != other.size(); ++i) /* Can't use {}, see the GCC 4.8-specific overload for details */ #if defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG) && __GNUC__ < 5 @@ -649,7 +648,7 @@ template StaticArray::StaticArray(const St #endif } -template StaticArray::StaticArray(StaticArray&& other) noexcept(std::is_nothrow_move_constructible::value): StaticArray{NoInit} { +template StaticArray::StaticArray(StaticArray&& other) noexcept(std::is_nothrow_move_constructible::value): StaticArray{Corrade::NoInit} { for(std::size_t i = 0; i != other.size(); ++i) /* Can't use {}, see the GCC 4.8-specific overload for details */ #if defined(CORRADE_TARGET_GCC) && !defined(CORRADE_TARGET_CLANG) && __GNUC__ < 5 diff --git a/src/Corrade/Containers/StridedArrayView.h b/src/Corrade/Containers/StridedArrayView.h index 4b4e8b09b..d1359b621 100644 --- a/src/Corrade/Containers/StridedArrayView.h +++ b/src/Corrade/Containers/StridedArrayView.h @@ -30,9 +30,9 @@ * @brief Class @ref Corrade::Containers::StridedArrayView, @ref Corrade::Containers::StridedIterator, alias @ref Corrade::Containers::StridedArrayView1D, @ref Corrade::Containers::StridedArrayView2D, @ref Corrade::Containers::StridedArrayView3D, @ref Corrade::Containers::StridedArrayView4D */ +#include "Corrade/Tags.h" #include "Corrade/Containers/ArrayView.h" #include "Corrade/Containers/sequenceHelpers.h" -#include "Corrade/Containers/Tags.h" namespace Corrade { namespace Containers { @@ -116,10 +116,10 @@ template class StridedDimensions { constexpr /*implicit*/ StridedDimensions() noexcept: _data{} {} /** @brief Construct with zero-initialized data */ - constexpr explicit StridedDimensions(ValueInitT) noexcept: _data{} {} + constexpr explicit StridedDimensions(Corrade::ValueInitT) noexcept: _data{} {} /** @brief Construct without initializing the contents */ - explicit StridedDimensions(NoInitT) noexcept {} + explicit StridedDimensions(Corrade::NoInitT) noexcept {} /** @brief Constructor */ template constexpr /*implicit*/ StridedDimensions(T first, Args... next) noexcept: _data{T(first), T(next)...} { @@ -1759,8 +1759,8 @@ template StridedArrayView StridedAr template template StridedArrayView StridedArrayView::slice(const Size& begin, const Size& end) const { constexpr unsigned minDimensions = dimensions < newDimensions ? dimensions : newDimensions; - StridedDimensions size{NoInit}; - StridedDimensions stride{NoInit}; + StridedDimensions size{Corrade::NoInit}; + StridedDimensions stride{Corrade::NoInit}; auto data = static_cast::value, const char, char>::type*>(_data); /* Adjust data pointer based on offsets of all source dimensions */ @@ -1791,7 +1791,7 @@ template template StridedA } template template StridedArrayView StridedArrayView::except(const Size& count) const { - Size end{NoInit}; + Size end{Corrade::NoInit}; for(std::size_t i = 0; i != dimensions; ++i) end._data[i] = _size._data[i] - count._data[i]; return slice({}, end); diff --git a/src/Corrade/Containers/String.cpp b/src/Corrade/Containers/String.cpp index ff4555e9a..5069e96ac 100644 --- a/src/Corrade/Containers/String.cpp +++ b/src/Corrade/Containers/String.cpp @@ -59,7 +59,7 @@ String String::nullTerminatedGlobalView(StringView view) { return String{view}; } -inline void String::construct(NoInitT, const std::size_t size) { +inline void String::construct(Corrade::NoInitT, const std::size_t size) { if(size < Implementation::SmallStringSize) { _small.data[size] = '\0'; _small.size = size | SmallSize; @@ -72,7 +72,7 @@ inline void String::construct(NoInitT, const std::size_t size) { } inline void String::construct(const char* const data, const std::size_t size) { - construct(NoInit, size); + construct(Corrade::NoInit, size); /* If the size is small enough for SSO, use that. Not using <= because we need to store the null terminator as well. */ @@ -178,7 +178,7 @@ String::String(char* const data, const std::size_t size, void(*deleter)(char*, s _large.deleter = deleter; } -String::String(ValueInitT, const std::size_t size): _large{} { +String::String(Corrade::ValueInitT, const std::size_t size): _large{} { CORRADE_ASSERT(size < std::size_t{1} << (sizeof(std::size_t)*8 - 2), "Containers::String: string expected to be smaller than 2^" << Utility::Debug::nospace << sizeof(std::size_t)*8 - 2 << "bytes, got" << size, ); @@ -192,7 +192,7 @@ String::String(ValueInitT, const std::size_t size): _large{} { } } -String::String(DirectInitT, const std::size_t size, const char c): String{NoInit, size} { +String::String(Corrade::DirectInitT, const std::size_t size, const char c): String{Corrade::NoInit, size} { #ifdef CORRADE_GRACEFUL_ASSERT /* If the NoInit constructor asserted, don't attempt to memset */ if(size >= Implementation::SmallStringSize && !_large.data) return; @@ -201,7 +201,7 @@ String::String(DirectInitT, const std::size_t size, const char c): String{NoInit std::memset(size < Implementation::SmallStringSize ? _small.data : _large.data, c, size); } -String::String(NoInitT, const std::size_t size) +String::String(Corrade::NoInitT, const std::size_t size) #ifdef CORRADE_GRACEFUL_ASSERT /* Zero-init the contents so the destructor doesn't crash if we assert here */ : _large{} @@ -210,7 +210,7 @@ String::String(NoInitT, const std::size_t size) CORRADE_ASSERT(size < std::size_t{1} << (sizeof(std::size_t)*8 - 2), "Containers::String: string expected to be smaller than 2^" << Utility::Debug::nospace << sizeof(std::size_t)*8 - 2 << "bytes, got" << size, ); - construct(NoInit, size); + construct(Corrade::NoInit, size); } String::~String() { destruct(); } diff --git a/src/Corrade/Containers/String.h b/src/Corrade/Containers/String.h index abe134694..50b0eb916 100644 --- a/src/Corrade/Containers/String.h +++ b/src/Corrade/Containers/String.h @@ -334,7 +334,7 @@ class CORRADE_UTILITY_EXPORT String { * its behavior would be the same to @ref String(NoInitT, std::size_t). * @see @ref String(DirectInitT, std::size_t, char) */ - explicit String(ValueInitT, std::size_t size); + explicit String(Corrade::ValueInitT, std::size_t size); /** * @brief Create a string initialized to a particular character @@ -344,7 +344,7 @@ class CORRADE_UTILITY_EXPORT String { * @see @ref String(ValueInitT, std::size_t), * @ref String(NoInitT, std::size_t) */ - explicit String(DirectInitT, std::size_t size, char c); + explicit String(Corrade::DirectInitT, std::size_t size, char c); /** * @brief Create an uninitialized string @@ -354,7 +354,7 @@ class CORRADE_UTILITY_EXPORT String { * *does* get initialized to @cpp '\0' @ce. Useful if you're going to * overwrite the contents anyway. */ - explicit String(NoInitT, std::size_t size); + explicit String(Corrade::NoInitT, std::size_t size); /** @todo combined AllocatedInit + Value/Direct/NoInit constructors */ @@ -793,7 +793,7 @@ class CORRADE_UTILITY_EXPORT String { char* release(); private: - CORRADE_UTILITY_LOCAL void construct(NoInitT, std::size_t size); + CORRADE_UTILITY_LOCAL void construct(Corrade::NoInitT, std::size_t size); CORRADE_UTILITY_LOCAL void construct(const char* data, std::size_t size); CORRADE_UTILITY_LOCAL void destruct(); CORRADE_UTILITY_LOCAL std::pair dataInternal() const; diff --git a/src/Corrade/Containers/StringView.cpp b/src/Corrade/Containers/StringView.cpp index f52de8d59..ee1703c06 100644 --- a/src/Corrade/Containers/StringView.cpp +++ b/src/Corrade/Containers/StringView.cpp @@ -224,7 +224,7 @@ template String BasicStringView::join(const ArrayView String BasicStringView::joinWithoutEmptyParts(const ArrayVi if(totalSize) totalSize -= delimiterSize; /* Reserve memory for the resulting string */ - String result{NoInit, totalSize}; + String result{Corrade::NoInit, totalSize}; /* Join strings */ char* out = result.data(); diff --git a/src/Corrade/Containers/Tags.h b/src/Corrade/Containers/Tags.h index 50f91519e..e3134d749 100644 --- a/src/Corrade/Containers/Tags.h +++ b/src/Corrade/Containers/Tags.h @@ -26,150 +26,25 @@ DEALINGS IN THE SOFTWARE. */ +#ifdef CORRADE_BUILD_DEPRECATED /** @file - * @brief Tag type @ref Corrade::Containers::ValueInitT, @ref Corrade::Containers::DefaultInitT, @ref Corrade::Containers::NoInitT, @ref Corrade::Containers::DirectInitT, tag @ref Corrade::Containers::ValueInit, @ref Corrade::Containers::DefaultInit, @ref Corrade::Containers::NoInit, @ref Corrade::Containers::DirectInit + * @deprecated Tag types and tags + * @m_deprecated_since_latest Use @ref Corrade/Tags.h instead. */ +#endif #include "Corrade/configure.h" -namespace Corrade { namespace Containers { - -/** -@brief Default initialization tag type - -Used to distinguish construction with default initialization. The actual -meaning of "default" may vary, see documentation of a particular API using this -tag for a detailed behavior description. -@see @ref DefaultInit -*/ -/* Explicit constructor to avoid ambiguous calls when using {} */ -struct DefaultInitT { - #ifndef DOXYGEN_GENERATING_OUTPUT - struct Init{}; - constexpr explicit DefaultInitT(Init) {} - #endif -}; - -/** -@brief Value initialization tag type - -Used to distinguish construction with value initialization (builtin types are -zeroed out, others are default-constructed). -@see @ref ValueInit -*/ -/* Explicit constructor to avoid ambiguous calls when using {} */ -struct ValueInitT { - #ifndef DOXYGEN_GENERATING_OUTPUT - struct Init{}; - constexpr explicit ValueInitT(Init) {} - #endif -}; - -/** -@brief No initialization tag type - -Used to distinguish construction with no initialization at all, which leaves -the data with whatever random values the memory had before. -@see @ref NoInit, @ref NoCreateT -*/ -/* Explicit constructor to avoid ambiguous calls when using {} */ -struct NoInitT { - #ifndef DOXYGEN_GENERATING_OUTPUT - struct Init{}; - constexpr explicit NoInitT(Init) {} - #endif -}; - -/** -@brief No creation tag type - -Used to distinguish construction with initialization but not creation. Contrary -to @ref NoInitT this doesn't keep random values, but makes the instance empty -(usually equivalent to a moved-out state). -@see @ref NoCreate -*/ -/* Explicit constructor to avoid ambiguous calls when using {} */ -struct NoCreateT { - #ifndef DOXYGEN_GENERATING_OUTPUT - struct Init{}; - constexpr explicit NoCreateT(Init) {} - #endif -}; - -/** -@brief Direct initialization tag type - -Used to distinguish construction with direct initialization. -@see @ref DirectInit -*/ -/* Explicit constructor to avoid ambiguous calls when using {} */ -struct DirectInitT { - #ifndef DOXYGEN_GENERATING_OUTPUT - struct Init{}; - constexpr explicit DirectInitT(Init) {} - #endif -}; - -/** -@brief In-place initialization tag type - -Used to distinguish construction with in-place initialization. -@see @ref DirectInit -*/ -/* Explicit constructor to avoid ambiguous calls when using {} */ -struct InPlaceInitT { - #ifndef DOXYGEN_GENERATING_OUTPUT - struct Init{}; - constexpr explicit InPlaceInitT(Init) {} - #endif -}; +#ifdef CORRADE_BUILD_DEPRECATED +#include "Corrade/Tags.h" -/** -@brief Default initialization tag +CORRADE_DEPRECATED_FILE("use Corrade/Tags.h and tags in the Corrade namespace instead") -Use for construction with default initialization. The actual meaning of -"default" may vary, see documentation of a particular API using this tag for -a detailed behavior description. -*/ -constexpr DefaultInitT DefaultInit{DefaultInitT::Init{}}; - -/** -@brief Value initialization tag - -Use for construction using value initialization (builtin types are zeroed out, -others are default-constructed). -*/ -constexpr ValueInitT ValueInit{ValueInitT::Init{}}; - -/** -@brief No initialization tag - -Use for construction with no initialization at all. -*/ -constexpr NoInitT NoInit{NoInitT::Init{}}; - -/** -@brief No creation tag - -Use for construction with initialization, but keeping the instance empty -(usually equivalent to a moved-out state). -*/ -constexpr NoCreateT NoCreate{NoCreateT::Init{}}; - -/** -@brief Direct initialization tag - -Use for construction with direct initialization. -*/ -constexpr DirectInitT DirectInit{DirectInitT::Init{}}; - -/** -@brief In-place initialization tag - -Use for construction in-place. -*/ -constexpr InPlaceInitT InPlaceInit{InPlaceInitT::Init{}}; - -}} +/* Deprecated aliases defined in Corrade/Tags.h and not here since most code + relies on the header being included transitively and so the aliases wouldn't + be found if we'd switch to the new header everywhere */ +#else +#error use Corrade/Tags.h and tags in the Corrade namespace instead +#endif #endif diff --git a/src/Corrade/Containers/Test/ArrayStlSpanTest.cpp b/src/Corrade/Containers/Test/ArrayStlSpanTest.cpp index 45bd8aa50..90eb826f1 100644 --- a/src/Corrade/Containers/Test/ArrayStlSpanTest.cpp +++ b/src/Corrade/Containers/Test/ArrayStlSpanTest.cpp @@ -58,7 +58,7 @@ void ArrayStlSpanTest::toSpan() { #if !__has_include() CORRADE_SKIP("The header is not available on this platform."); #else - Array a{InPlaceInit, {42.0f, 13.37f, -25.0f}}; + Array a{Corrade::InPlaceInit, {42.0f, 13.37f, -25.0f}}; std::span b = a; CORRADE_COMPARE(b.data(), a.data()); @@ -88,7 +88,7 @@ void ArrayStlSpanTest::toSpanConst() { #if !__has_include() CORRADE_SKIP("The header is not available on this platform."); #else - Array a{InPlaceInit, {42.0f, 13.37f, -25.0f}}; + Array a{Corrade::InPlaceInit, {42.0f, 13.37f, -25.0f}}; std::span b = a; CORRADE_COMPARE(b.data(), a.data()); diff --git a/src/Corrade/Containers/Test/ArrayTest.cpp b/src/Corrade/Containers/Test/ArrayTest.cpp index 0e9e8f3fc..d0b218106 100644 --- a/src/Corrade/Containers/Test/ArrayTest.cpp +++ b/src/Corrade/Containers/Test/ArrayTest.cpp @@ -223,7 +223,7 @@ void ArrayTest::constructFromExisting() { } void ArrayTest::constructDefaultInit() { - const Array a{DefaultInit, 5}; + const Array a{Corrade::DefaultInit, 5}; CORRADE_VERIFY(a); CORRADE_COMPARE(a.size(), 5); @@ -231,7 +231,7 @@ void ArrayTest::constructDefaultInit() { } void ArrayTest::constructValueInit() { - const Array a{ValueInit, 5}; + const Array a{Corrade::ValueInit, 5}; CORRADE_VERIFY(a); CORRADE_COMPARE(a.size(), 5); @@ -244,7 +244,7 @@ void ArrayTest::constructValueInit() { } void ArrayTest::constructNoInitTrivial() { - const Array a{NoInit, 5}; + const Array a{Corrade::NoInit, 5}; CORRADE_VERIFY(a); CORRADE_COMPARE(a.size(), 5); CORRADE_VERIFY(!a.deleter()); @@ -258,18 +258,18 @@ struct Foo { int Foo::constructorCallCount = 0; void ArrayTest::constructNoInitNonTrivial() { - const Containers::Array a{NoInit, 5}; + const Containers::Array a{Corrade::NoInit, 5}; CORRADE_VERIFY(a); CORRADE_COMPARE(a.size(), 5); CORRADE_VERIFY(a.deleter()); CORRADE_COMPARE(Foo::constructorCallCount, 0); - const Containers::Array b{DefaultInit, 7}; + const Containers::Array b{Corrade::DefaultInit, 7}; CORRADE_COMPARE(Foo::constructorCallCount, 7); } void ArrayTest::constructDirectInit() { - const Array a{DirectInit, 2, -37}; + const Array a{Corrade::DirectInit, 2, -37}; CORRADE_VERIFY(a); CORRADE_COMPARE(a.size(), 2); CORRADE_COMPARE(a[0], -37); @@ -277,7 +277,7 @@ void ArrayTest::constructDirectInit() { } void ArrayTest::constructInPlaceInit() { - Array a1{InPlaceInit, {1, 3, 127, -48}}; + Array a1{Corrade::InPlaceInit, {1, 3, 127, -48}}; CORRADE_VERIFY(a1); CORRADE_COMPARE(a1.size(), 4); CORRADE_COMPARE(a1[0], 1); @@ -293,7 +293,7 @@ void ArrayTest::constructInPlaceInit() { CORRADE_COMPARE(a2[2], 127); CORRADE_COMPARE(a2[3], -48); - Array b1{InPlaceInit, {}}; + Array b1{Corrade::InPlaceInit, {}}; CORRADE_VERIFY(!b1); Array b2 = array({}); @@ -348,7 +348,7 @@ void ArrayTest::constructDirectReferences() { Reference(NonCopyable&) {} }; - const Containers::Array b{Containers::DirectInit, 5, a}; + const Containers::Array b{Corrade::DirectInit, 5, a}; CORRADE_COMPARE(b.size(), 5); } @@ -488,7 +488,7 @@ void ArrayTest::convertConstVoid() { } void ArrayTest::convertToExternalView() { - Array a{InPlaceInit, {1, 2, 3, 4, 5}}; + Array a{Corrade::InPlaceInit, {1, 2, 3, 4, 5}}; IntView b = a; CORRADE_COMPARE(b.data, a); @@ -506,7 +506,7 @@ void ArrayTest::convertToExternalView() { } void ArrayTest::convertToConstExternalView() { - const Array a{InPlaceInit, {1, 2, 3, 4, 5}}; + const Array a{Corrade::InPlaceInit, {1, 2, 3, 4, 5}}; ConstIntView b = a; CORRADE_COMPARE(b.data, a); @@ -541,7 +541,7 @@ void ArrayTest::access() { CORRADE_COMPARE(a.cbegin(), a.begin()); CORRADE_COMPARE(a.cend(), a.end()); - const Array b{InPlaceInit, {7, 3, 5, 4}}; + const Array b{Corrade::InPlaceInit, {7, 3, 5, 4}}; CORRADE_COMPARE(b.data(), static_cast(b)); CORRADE_COMPARE(b[2], 5); } @@ -579,7 +579,7 @@ void ArrayTest::accessInvalid() { } void ArrayTest::rvalueArrayAccess() { - CORRADE_COMPARE((Array{InPlaceInit, {1, 2, 3, 4}}[2]), 3); + CORRADE_COMPARE((Array{Corrade::InPlaceInit, {1, 2, 3, 4}}[2]), 3); } void ArrayTest::rangeBasedFor() { @@ -600,8 +600,8 @@ void ArrayTest::rangeBasedFor() { } void ArrayTest::slice() { - Array a{InPlaceInit, {1, 2, 3, 4, 5}}; - const Array ac{InPlaceInit, {1, 2, 3, 4, 5}}; + Array a{Corrade::InPlaceInit, {1, 2, 3, 4, 5}}; + const Array ac{Corrade::InPlaceInit, {1, 2, 3, 4, 5}}; ArrayView b = a.slice(1, 4); CORRADE_COMPARE(b.size(), 3); @@ -653,8 +653,8 @@ void ArrayTest::slice() { } void ArrayTest::slicePointer() { - Array a{InPlaceInit, {1, 2, 3, 4, 5}}; - const Array ac{InPlaceInit, {1, 2, 3, 4, 5}}; + Array a{Corrade::InPlaceInit, {1, 2, 3, 4, 5}}; + const Array ac{Corrade::InPlaceInit, {1, 2, 3, 4, 5}}; ArrayView b = a.slice(a + 1, a + 4); CORRADE_COMPARE(b.size(), 3); @@ -694,8 +694,8 @@ void ArrayTest::slicePointer() { } void ArrayTest::sliceToStatic() { - Array a{InPlaceInit, {1, 2, 3, 4, 5}}; - const Array ac{InPlaceInit, {1, 2, 3, 4, 5}}; + Array a{Corrade::InPlaceInit, {1, 2, 3, 4, 5}}; + const Array ac{Corrade::InPlaceInit, {1, 2, 3, 4, 5}}; StaticArrayView<3, int> b1 = a.slice<3>(1); CORRADE_COMPARE(b1[0], 2); @@ -731,8 +731,8 @@ void ArrayTest::sliceToStatic() { } void ArrayTest::sliceToStaticPointer() { - Array a{InPlaceInit, {1, 2, 3, 4, 5}}; - const Array ac{InPlaceInit, {1, 2, 3, 4, 5}}; + Array a{Corrade::InPlaceInit, {1, 2, 3, 4, 5}}; + const Array ac{Corrade::InPlaceInit, {1, 2, 3, 4, 5}}; StaticArrayView<3, int> b = a.slice<3>(a + 1); CORRADE_COMPARE(b[0], 2); @@ -886,7 +886,7 @@ void ArrayTest::emplaceConstructorExplicitInCopyInitialization() { static_cast(a); /* So this should too */ - Containers::Array b{DirectInit, 5}; + Containers::Array b{Corrade::DirectInit, 5}; CORRADE_COMPARE(b.size(), 5); } @@ -899,11 +899,11 @@ void ArrayTest::copyConstructPlainStruct() { /* This needs special handling on GCC 4.8, where T{b} (copy-construction) attempts to convert ExtremelyTrivial to int to initialize the first argument and fails miserably. */ - Containers::Array a{DirectInit, 2, 3, 'a'}; + Containers::Array a{Corrade::DirectInit, 2, 3, 'a'}; CORRADE_COMPARE(a.size(), 2); /* This copy-constructs the new values */ - Containers::Array b{InPlaceInit, { + Containers::Array b{Corrade::InPlaceInit, { {4, 'b'}, {5, 'c'}, {6, 'd'} @@ -921,7 +921,7 @@ void ArrayTest::moveConstructPlainStruct() { /* This needs special handling on GCC 4.8, where T{std::move(b)} attempts to convert MoveOnlyStruct to int to initialize the first argument and fails miserably. */ - Containers::Array a{DirectInit, 2, 3, 'a', nullptr}; + Containers::Array a{Corrade::DirectInit, 2, 3, 'a', nullptr}; CORRADE_COMPARE(a.size(), 2); /* Unlike with copyConstructPlainStruct(), the InPlaceInit doesn't use diff --git a/src/Corrade/Containers/Test/ArrayTupleTest.cpp b/src/Corrade/Containers/Test/ArrayTupleTest.cpp index 1ac7cae55..8f9b93f94 100644 --- a/src/Corrade/Containers/Test/ArrayTupleTest.cpp +++ b/src/Corrade/Containers/Test/ArrayTupleTest.cpp @@ -268,10 +268,10 @@ void ArrayTupleTest::constructNoInit() { ArrayView noncopyable; ArrayView initializedNoncopyable; ArrayTuple data{ - {{NoInit, 15, chars}, - {ValueInit, 15, initializedChars}, - {NoInit, 3, noncopyable}, - {ValueInit, 2, initializedNoncopyable}}, + {{Corrade::NoInit, 15, chars}, + {Corrade::ValueInit, 15, initializedChars}, + {Corrade::NoInit, 3, noncopyable}, + {Corrade::ValueInit, 2, initializedNoncopyable}}, [&](std::size_t, std::size_t) -> std::pair { return {storage, [](char*, std::size_t) { }}; } diff --git a/src/Corrade/Containers/Test/BigEnumSetTest.cpp b/src/Corrade/Containers/Test/BigEnumSetTest.cpp index d29e7a84d..16c08d5a8 100644 --- a/src/Corrade/Containers/Test/BigEnumSetTest.cpp +++ b/src/Corrade/Containers/Test/BigEnumSetTest.cpp @@ -218,7 +218,7 @@ void BigEnumSetTest::constructNoInit() { } } { Features features{Feature::Tested}; - new(&features) Features{NoInit}; + new(&features) Features{Corrade::NoInit}; #if defined(__GNUC__) && __GNUC__*100 + __GNUC_MINOR__ >= 601 && __OPTIMIZE__ CORRADE_EXPECT_FAIL("GCC 6.1+ misoptimizes and overwrites the value."); #pragma GCC diagnostic push diff --git a/src/Corrade/Containers/Test/CMakeLists.txt b/src/Corrade/Containers/Test/CMakeLists.txt index 5ea11755b..4678bc3b7 100644 --- a/src/Corrade/Containers/Test/CMakeLists.txt +++ b/src/Corrade/Containers/Test/CMakeLists.txt @@ -64,7 +64,6 @@ corrade_add_test(ContainersStringTest StringTest.cpp LIBRARIES CorradeUtilityTes corrade_add_test(ContainersStringStlTest StringStlTest.cpp) corrade_add_test(ContainersStringViewTest StringViewTest.cpp LIBRARIES CorradeUtilityTestLib) corrade_add_test(ContainersStringViewStlTest StringViewStlTest.cpp) -corrade_add_test(ContainersTagsTest TagsTest.cpp) set_property(TARGET ContainersAnyReferenceTest @@ -103,7 +102,6 @@ set_target_properties( ContainersStringStlTest ContainersStringViewTest ContainersStringViewStlTest - ContainersTagsTest PROPERTIES FOLDER "Corrade/Containers/Test") # Build these only if there's no explicit -std= passed in the flags diff --git a/src/Corrade/Containers/Test/EnumSetTest.cpp b/src/Corrade/Containers/Test/EnumSetTest.cpp index c6bac48c5..035394d42 100644 --- a/src/Corrade/Containers/Test/EnumSetTest.cpp +++ b/src/Corrade/Containers/Test/EnumSetTest.cpp @@ -128,7 +128,7 @@ void EnumSetTest::constructNoInit() { CORRADE_COMPARE(int(features), 0); } { Features features{Feature::Tested}; - new(&features)Features{NoInit}; + new(&features)Features{Corrade::NoInit}; #if defined(__GNUC__) && __GNUC__*100 + __GNUC_MINOR__ >= 601 && __OPTIMIZE__ CORRADE_EXPECT_FAIL("GCC 6.1+ misoptimizes and overwrites the value."); #pragma GCC diagnostic push diff --git a/src/Corrade/Containers/Test/GrowableArrayTest.cpp b/src/Corrade/Containers/Test/GrowableArrayTest.cpp index 448f0235e..e28723f0c 100644 --- a/src/Corrade/Containers/Test/GrowableArrayTest.cpp +++ b/src/Corrade/Containers/Test/GrowableArrayTest.cpp @@ -246,22 +246,22 @@ GrowableArrayTest::GrowableArrayTest() { &GrowableArrayTest::resizeValueInit, &GrowableArrayTest::resizeDirectInit, - &GrowableArrayTest::resizeFromNonGrowableToLess, - &GrowableArrayTest::resizeFromNonGrowableToLess, - &GrowableArrayTest::resizeFromNonGrowableToLess, - &GrowableArrayTest::resizeFromNonGrowableToLess, - &GrowableArrayTest::resizeFromNonGrowableToLess, - &GrowableArrayTest::resizeFromNonGrowableToLess, - &GrowableArrayTest::resizeFromNonGrowableToLess, - &GrowableArrayTest::resizeFromNonGrowableToLess, - &GrowableArrayTest::resizeFromGrowableToLess, - &GrowableArrayTest::resizeFromGrowableToLess, - &GrowableArrayTest::resizeFromGrowableToLess, - &GrowableArrayTest::resizeFromGrowableToLess, - &GrowableArrayTest::resizeFromGrowableToLess, - &GrowableArrayTest::resizeFromGrowableToLess, - &GrowableArrayTest::resizeFromGrowableToLess, - &GrowableArrayTest::resizeFromGrowableToLess, + &GrowableArrayTest::resizeFromNonGrowableToLess, + &GrowableArrayTest::resizeFromNonGrowableToLess, + &GrowableArrayTest::resizeFromNonGrowableToLess, + &GrowableArrayTest::resizeFromNonGrowableToLess, + &GrowableArrayTest::resizeFromNonGrowableToLess, + &GrowableArrayTest::resizeFromNonGrowableToLess, + &GrowableArrayTest::resizeFromNonGrowableToLess, + &GrowableArrayTest::resizeFromNonGrowableToLess, + &GrowableArrayTest::resizeFromGrowableToLess, + &GrowableArrayTest::resizeFromGrowableToLess, + &GrowableArrayTest::resizeFromGrowableToLess, + &GrowableArrayTest::resizeFromGrowableToLess, + &GrowableArrayTest::resizeFromGrowableToLess, + &GrowableArrayTest::resizeFromGrowableToLess, + &GrowableArrayTest::resizeFromGrowableToLess, + &GrowableArrayTest::resizeFromGrowableToLess, &GrowableArrayTest::appendFromEmpty, &GrowableArrayTest::appendFromEmpty, @@ -794,7 +794,7 @@ template void GrowableArrayTest::resizeNoInit() { setTestCaseTemplateName(TypeName::name()); Array a; - arrayResize(a, NoInit, 3); + arrayResize(a, Corrade::NoInit, 3); CORRADE_COMPARE(a.size(), 3); VERIFY_SANITIZED_PROPERLY(a, ArrayAllocator); @@ -805,7 +805,7 @@ template void GrowableArrayTest::resizeDefaultInit() { setTestCaseTemplateName(TypeName::name()); Array a; - arrayResize(a, DefaultInit, 3); + arrayResize(a, Corrade::DefaultInit, 3); CORRADE_COMPARE(a.size(), 3); VERIFY_SANITIZED_PROPERLY(a, ArrayAllocator); @@ -821,7 +821,7 @@ template void GrowableArrayTest::resizeValueInit() { setTestCaseTemplateName(TypeName::name()); Array a; - arrayResize(a, ValueInit, 3); + arrayResize(a, Corrade::ValueInit, 3); CORRADE_COMPARE(a.size(), 3); CORRADE_COMPARE(int(a[0]), 0); CORRADE_COMPARE(int(a[1]), 0); @@ -834,7 +834,7 @@ void GrowableArrayTest::resizeDirectInit() { need to test twice */ Array a; - arrayResize(a, DirectInit, 3, 754831); + arrayResize(a, Corrade::DirectInit, 3, 754831); CORRADE_COMPARE(a.size(), 3); CORRADE_COMPARE(a[0], 754831); CORRADE_COMPARE(a[1], 754831); @@ -843,16 +843,16 @@ void GrowableArrayTest::resizeDirectInit() { } template struct InitTagName; -template<> struct InitTagName { +template<> struct InitTagName { static const char* name() { return "NoInit"; } }; -template<> struct InitTagName { +template<> struct InitTagName { static const char* name() { return "DefaultInitT"; } }; -template<> struct InitTagName { +template<> struct InitTagName { static const char* name() { return "ValueInitT"; } }; -template<> struct InitTagName { +template<> struct InitTagName { static const char* name() { return "DirectInitT"; } }; @@ -1175,7 +1175,7 @@ void GrowableArrayTest::appendListEmpty() { void GrowableArrayTest::appendCountNoInit() { Array a; - Containers::ArrayView appended = arrayAppend(a, Containers::NoInit, 4); + Containers::ArrayView appended = arrayAppend(a, Corrade::NoInit, 4); CORRADE_COMPARE(a.size(), 4); CORRADE_COMPARE(arrayCapacity(a), 4); /** @todo use growing here too */ CORRADE_COMPARE(appended.data(), a.data()); @@ -1186,7 +1186,7 @@ void GrowableArrayTest::appendCountNoInit() { void GrowableArrayTest::appendCountNoInitEmpty() { Array a{3}; int* prev = a.data(); - Containers::ArrayView appended = arrayAppend(a, Containers::NoInit, 0); + Containers::ArrayView appended = arrayAppend(a, Corrade::NoInit, 0); /* Should be a no-op, not reallocating the (non-growable) array */ CORRADE_COMPARE(a.size(), 3); @@ -1351,10 +1351,10 @@ template void GrowableArrayTest::removeSuffixGrowable() { Array a; arrayReserve(a, 10); T* prev = a.data(); - arrayAppend(a, InPlaceInit, 2); - arrayAppend(a, InPlaceInit, 7); - arrayAppend(a, InPlaceInit, -1); - arrayAppend(a, InPlaceInit, 35786); + arrayAppend(a, Corrade::InPlaceInit, 2); + arrayAppend(a, Corrade::InPlaceInit, 7); + arrayAppend(a, Corrade::InPlaceInit, -1); + arrayAppend(a, Corrade::InPlaceInit, 35786); VERIFY_SANITIZED_PROPERLY(a, ArrayAllocator); /* Gets converted to growable as otherwise we can't ensure the @@ -1446,7 +1446,7 @@ template void GrowableArrayTest::shrinkNonGrowableEmptyDefaultInit() { Array a; /* Should do no nuthin' */ - arrayShrink(a, DefaultInit); + arrayShrink(a, Corrade::DefaultInit); CORRADE_VERIFY(!arrayIsGrowable(a)); CORRADE_COMPARE(a.size(), 0); CORRADE_VERIFY(!a.data()); @@ -1502,7 +1502,7 @@ template void GrowableArrayTest::shrinkNonGrowableDefaultInit() { a[2] = -1; /* Should do no nuthin' */ - arrayShrink(a, DefaultInit); + arrayShrink(a, Corrade::DefaultInit); CORRADE_VERIFY(!arrayIsGrowable(a)); CORRADE_COMPARE(a.size(), 3); CORRADE_VERIFY(a.data() == prev); @@ -1526,7 +1526,7 @@ template void GrowableArrayTest::shrinkGrowableEmptyNoInit() { { Array a; - arrayAppend(a, InPlaceInit, 2); + arrayAppend(a, Corrade::InPlaceInit, 2); arrayRemoveSuffix(a, 1); CORRADE_VERIFY(arrayIsGrowable(a)); CORRADE_VERIFY(a.empty()); @@ -1549,13 +1549,13 @@ template void GrowableArrayTest::shrinkGrowableEmptyDefaultInit() { { Array a; - arrayAppend(a, InPlaceInit, 2); + arrayAppend(a, Corrade::InPlaceInit, 2); arrayRemoveSuffix(a, 1); CORRADE_VERIFY(arrayIsGrowable(a)); CORRADE_VERIFY(a.empty()); CORRADE_VERIFY(arrayCapacity(a)); - arrayShrink(a, DefaultInit); + arrayShrink(a, Corrade::DefaultInit); } /* Nothing extra should be done by the shrink */ @@ -1574,9 +1574,9 @@ template void GrowableArrayTest::shrinkGrowableNoInit() { Array a; arrayReserve(a, 10); T* prev = a.data(); - arrayAppend(a, InPlaceInit, 2); - arrayAppend(a, InPlaceInit, 7); - arrayAppend(a, InPlaceInit, -1); + arrayAppend(a, Corrade::InPlaceInit, 2); + arrayAppend(a, Corrade::InPlaceInit, 7); + arrayAppend(a, Corrade::InPlaceInit, -1); /* Should convert to non-growable */ arrayShrink(a); @@ -1606,12 +1606,12 @@ template void GrowableArrayTest::shrinkGrowableDefaultInit() { Array a; arrayReserve(a, 10); T* prev = a.data(); - arrayAppend(a, InPlaceInit, 2); - arrayAppend(a, InPlaceInit, 7); - arrayAppend(a, InPlaceInit, -1); + arrayAppend(a, Corrade::InPlaceInit, 2); + arrayAppend(a, Corrade::InPlaceInit, 7); + arrayAppend(a, Corrade::InPlaceInit, -1); /* Should convert to non-growable */ - arrayShrink(a, DefaultInit); + arrayShrink(a, Corrade::DefaultInit); CORRADE_VERIFY(!arrayIsGrowable(a)); CORRADE_COMPARE(a.size(), 3); CORRADE_COMPARE(arrayCapacity(a), 3); @@ -1735,11 +1735,11 @@ void GrowableArrayTest::explicitAllocatorParameter() { CORRADE_VERIFY(arrayIsGrowable(a)); CORRADE_COMPARE(arrayCapacity(a), 10); - arrayResize(a, DefaultInit, 1); - arrayResize(a, ValueInit, 2); + arrayResize(a, Corrade::DefaultInit, 1); + arrayResize(a, Corrade::ValueInit, 2); arrayResize(a, 3); - arrayResize(a, NoInit, 4); - arrayResize(a, DirectInit, 5, 6); + arrayResize(a, Corrade::NoInit, 4); + arrayResize(a, Corrade::DirectInit, 5, 6); CORRADE_VERIFY(!arrayIsGrowable(a)); CORRADE_VERIFY(arrayIsGrowable(a)); CORRADE_COMPARE(a.size(), 5); @@ -1749,7 +1749,7 @@ void GrowableArrayTest::explicitAllocatorParameter() { int& value = arrayAppend(a, six); CORRADE_COMPARE(value, 6); } { - int& value = arrayAppend(a, InPlaceInit, 7); + int& value = arrayAppend(a, Corrade::InPlaceInit, 7); CORRADE_COMPARE(value, 7); } { Containers::ArrayView view = arrayAppend(a, {8, 9, 10}); @@ -1761,7 +1761,7 @@ void GrowableArrayTest::explicitAllocatorParameter() { CORRADE_COMPARE(view.size(), 3); CORRADE_COMPARE(view[1], 12); } { - Containers::ArrayView view = arrayAppend(a, NoInit, 2); + Containers::ArrayView view = arrayAppend(a, Corrade::NoInit, 2); CORRADE_COMPARE(view.size(), 2); view[0] = 14; view[1] = 15; @@ -1774,9 +1774,9 @@ void GrowableArrayTest::explicitAllocatorParameter() { CORRADE_COMPARE(a.size(), 14); Array b; - arrayResize(b, DirectInit, 5, Movable{6}); + arrayResize(b, Corrade::DirectInit, 5, Movable{6}); arrayAppend(b, Movable{1}); - arrayAppend(b, InPlaceInit, 2); + arrayAppend(b, Corrade::InPlaceInit, 2); CORRADE_COMPARE(b.size(), 7); } @@ -1796,8 +1796,8 @@ void GrowableArrayTest::emplaceConstructorExplicitInCopyInitialization() { /* So this should too */ Containers::Array b; - arrayResize(b, DirectInit, 1); - arrayAppend(b, InPlaceInit); + arrayResize(b, Corrade::DirectInit, 1); + arrayAppend(b, Corrade::InPlaceInit); CORRADE_COMPARE(b.size(), 2); } @@ -1815,7 +1815,7 @@ void GrowableArrayTest::copyConstructPlainStruct() { arrayAppend(a, ExtremelyTrivial{3, 'a'}); /* This copy-constructs the new values */ - arrayResize(a, DirectInit, 10, ExtremelyTrivial{4, 'b'}); + arrayResize(a, Corrade::DirectInit, 10, ExtremelyTrivial{4, 'b'}); /* And this also */ const ExtremelyTrivial data[2]{ @@ -1839,9 +1839,9 @@ void GrowableArrayTest::moveConstructPlainStruct() { /* This needs special handling on GCC 4.8, where T{std::move(b)} attempts to convert MoveOnlyStruct to int to initialize the first argument and fails miserably. */ - arrayAppend(a, InPlaceInit, 3, 'a', nullptr); - arrayAppend(a, InPlaceInit, 4, 'b', nullptr); - arrayAppend(a, InPlaceInit, 5, 'c', nullptr); + arrayAppend(a, Corrade::InPlaceInit, 3, 'a', nullptr); + arrayAppend(a, Corrade::InPlaceInit, 4, 'b', nullptr); + arrayAppend(a, Corrade::InPlaceInit, 5, 'c', nullptr); /* This is another case where move constructors get called */ arrayResize(a, 15); @@ -1869,7 +1869,7 @@ void GrowableArrayTest::benchmarkAppendArray() { Array array; CORRADE_BENCHMARK(1) { for(std::size_t i = 0; i != 1000000; ++i) - arrayAppend(array, InPlaceInit, int(i)); + arrayAppend(array, Corrade::InPlaceInit, int(i)); } CORRADE_COMPARE(array.size(), 1000000); @@ -1894,7 +1894,7 @@ void GrowableArrayTest::benchmarkAppendReservedArray() { Movable* data = array.data(); CORRADE_BENCHMARK(1) { for(std::size_t i = 0; i != 1000000; ++i) - arrayAppend(array, InPlaceInit, int(i)); + arrayAppend(array, Corrade::InPlaceInit, int(i)); } CORRADE_COMPARE(array.size(), 1000000); diff --git a/src/Corrade/Containers/Test/OptionalTest.cpp b/src/Corrade/Containers/Test/OptionalTest.cpp index 8c4b17365..18da97c49 100644 --- a/src/Corrade/Containers/Test/OptionalTest.cpp +++ b/src/Corrade/Containers/Test/OptionalTest.cpp @@ -448,7 +448,7 @@ void OptionalTest::constructMoveMake() { void OptionalTest::constructInPlace() { { /* Using int{} to test perfect forwarding */ - Optional a{InPlaceInit, 32, int{}}; + Optional a{Corrade::InPlaceInit, 32, int{}}; CORRADE_VERIFY(a); CORRADE_COMPARE(a->a, 32); } @@ -468,9 +468,9 @@ void OptionalTest::constructInPlace() { CORRADE_VERIFY(!std::is_move_assignable>::value); } - CORRADE_VERIFY(std::is_nothrow_constructible, InPlaceInitT, int, int&&>::value); - CORRADE_VERIFY(std::is_constructible, InPlaceInitT, int>::value); - CORRADE_VERIFY(!std::is_nothrow_constructible, InPlaceInitT, int>::value); + CORRADE_VERIFY(std::is_nothrow_constructible, Corrade::InPlaceInitT, int, int&&>::value); + CORRADE_VERIFY(std::is_constructible, Corrade::InPlaceInitT, int>::value); + CORRADE_VERIFY(!std::is_nothrow_constructible, Corrade::InPlaceInitT, int>::value); } void OptionalTest::constructInPlaceMake() { @@ -511,7 +511,7 @@ void OptionalTest::constructInPlaceMakeAmbiguous() { auto d = optional(Ambiguous{}); auto e = optional(); auto f = optional(parent, 32); - auto g = Optional{InPlaceInit, parent}; + auto g = Optional{Corrade::InPlaceInit, parent}; auto h = Optional{parent}; CORRADE_COMPARE(a->parent, nullptr); /* wrong, but we can't disambiguate */ CORRADE_COMPARE(b->parent, nullptr); @@ -606,7 +606,7 @@ void OptionalTest::constructCopyFromNull() { void OptionalTest::constructCopyFromSet() { { - Optional a{InPlaceInit, 32}; + Optional a{Corrade::InPlaceInit, 32}; Optional b{a}; CORRADE_VERIFY(a); @@ -636,7 +636,7 @@ void OptionalTest::constructMoveFromNull() { void OptionalTest::constructMoveFromSet() { { - Optional a{InPlaceInit, 32}; + Optional a{Corrade::InPlaceInit, 32}; Optional b{std::move(a)}; /* A is still set, because the type destructor needs to be called */ @@ -717,7 +717,7 @@ void OptionalTest::copyNullToNull() { void OptionalTest::copyNullToSet() { { Optional a; - Optional b{InPlaceInit, 32}; + Optional b{Corrade::InPlaceInit, 32}; b = a; CORRADE_VERIFY(!a); @@ -732,7 +732,7 @@ void OptionalTest::copyNullToSet() { void OptionalTest::copySetToNull() { { - Optional a{InPlaceInit, 32}; + Optional a{Corrade::InPlaceInit, 32}; Optional b; b = a; @@ -749,8 +749,8 @@ void OptionalTest::copySetToNull() { void OptionalTest::copySetToSet() { { - Optional a{InPlaceInit, 32}; - Optional b{InPlaceInit, 78}; + Optional a{Corrade::InPlaceInit, 32}; + Optional b{Corrade::InPlaceInit, 78}; b = a; CORRADE_VERIFY(a); @@ -782,7 +782,7 @@ void OptionalTest::moveNullToNull() { void OptionalTest::moveNullToSet() { { Optional a; - Optional b{InPlaceInit, 32}; + Optional b{Corrade::InPlaceInit, 32}; b = std::move(a); CORRADE_VERIFY(!a); @@ -796,7 +796,7 @@ void OptionalTest::moveNullToSet() { void OptionalTest::moveSetToNull() { { - Optional a{InPlaceInit, 32}; + Optional a{Corrade::InPlaceInit, 32}; Optional b; b = std::move(a); @@ -812,8 +812,8 @@ void OptionalTest::moveSetToNull() { void OptionalTest::moveSetToSet() { { - Optional a{InPlaceInit, 32}; - Optional b{InPlaceInit, 78}; + Optional a{Corrade::InPlaceInit, 32}; + Optional b{Corrade::InPlaceInit, 78}; b = std::move(a); CORRADE_VERIFY(a); @@ -829,8 +829,8 @@ void OptionalTest::moveSetToSet() { CORRADE_COMPARE(Copyable::moved, 3); { - Optional a{InPlaceInit, 32}; - Optional b{InPlaceInit, 78}; + Optional a{Corrade::InPlaceInit, 32}; + Optional b{Corrade::InPlaceInit, 78}; b = std::move(a); CORRADE_VERIFY(a); @@ -859,7 +859,7 @@ void OptionalTest::moveNullOptToNull() { void OptionalTest::moveNullOptToSet() { { - Optional a{InPlaceInit, 32}; + Optional a{Corrade::InPlaceInit, 32}; a = NullOpt; CORRADE_VERIFY(!a); @@ -885,7 +885,7 @@ void OptionalTest::emplaceNull() { void OptionalTest::emplaceSet() { { - Optional a{InPlaceInit, 32}; + Optional a{Corrade::InPlaceInit, 32}; /* Using int{} to test perfect forwarding */ a.emplace(76, int{}); @@ -916,7 +916,7 @@ void OptionalTest::access() { } void OptionalTest::accessRvalue() { - Movable b = *Optional{InPlaceInit, 42}; + Movable b = *Optional{Corrade::InPlaceInit, 42}; CORRADE_COMPARE(b.a, 42); #if !defined(__GNUC__) || defined(__clang__) || __GNUC__ > 4 @@ -980,7 +980,7 @@ void OptionalTest::emplaceConstructorExplicitInCopyInitialization() { static_cast(a); /* So this should too */ - Optional b{InPlaceInit}; + Optional b{Corrade::InPlaceInit}; Optional c; c.emplace(); CORRADE_VERIFY(b); diff --git a/src/Corrade/Containers/Test/PointerTest.cpp b/src/Corrade/Containers/Test/PointerTest.cpp index 2b58d6ef9..ed21c9b1d 100644 --- a/src/Corrade/Containers/Test/PointerTest.cpp +++ b/src/Corrade/Containers/Test/PointerTest.cpp @@ -273,7 +273,7 @@ void PointerTest::constructMake() { void PointerTest::constructInPlace() { { /* Using int{} to test perfect forwarding */ - Pointer a{InPlaceInit, -13, int{}}; + Pointer a{Corrade::InPlaceInit, -13, int{}}; CORRADE_VERIFY(a); CORRADE_COMPARE(a->a, -13); } @@ -282,10 +282,10 @@ void PointerTest::constructInPlace() { CORRADE_COMPARE(Immovable::destructed, 1); /* This is never noexcept since we allocate (duh) */ - CORRADE_VERIFY(std::is_constructible, InPlaceInitT, int>::value); - CORRADE_VERIFY(!std::is_nothrow_constructible, InPlaceInitT, int, int&&>::value); - CORRADE_VERIFY(std::is_constructible, InPlaceInitT, int>::value); - CORRADE_VERIFY(!std::is_nothrow_constructible, InPlaceInitT, int>::value); + CORRADE_VERIFY(std::is_constructible, Corrade::InPlaceInitT, int>::value); + CORRADE_VERIFY(!std::is_nothrow_constructible, Corrade::InPlaceInitT, int, int&&>::value); + CORRADE_VERIFY(std::is_constructible, Corrade::InPlaceInitT, int>::value); + CORRADE_VERIFY(!std::is_nothrow_constructible, Corrade::InPlaceInitT, int>::value); } void PointerTest::constructInPlaceMake() { @@ -318,7 +318,7 @@ void PointerTest::constructInPlaceMakeAmbiguous() { //auto d = pointer(new Ambiguous); auto e = pointer(); auto f = pointer(&parent, 32); - auto g = Pointer{InPlaceInit, &parent}; + auto g = Pointer{Corrade::InPlaceInit, &parent}; auto h = Pointer{new Ambiguous}; //CORRADE_COMPARE(a->parent, &parent); //CORRADE_COMPARE(b->parent, nullptr); @@ -336,14 +336,14 @@ void PointerTest::constructDerived() { Derived(int a): Base{a} {} }; - Pointer a{InPlaceInit, 42}; + Pointer a{Corrade::InPlaceInit, 42}; Pointer b = std::move(a); CORRADE_VERIFY(!a); CORRADE_VERIFY(b); CORRADE_COMPARE(b->a, 42); /* Test assign as well */ - b = Pointer{InPlaceInit, 36}; + b = Pointer{Corrade::InPlaceInit, 36}; CORRADE_VERIFY(b); CORRADE_COMPARE(b->a, 36); @@ -411,8 +411,8 @@ void PointerTest::compareToNullptr() { void PointerTest::access() { { - Pointer a{InPlaceInit, 5}; - const Pointer ca{InPlaceInit, 8}; + Pointer a{Corrade::InPlaceInit, 5}; + const Pointer ca{Corrade::InPlaceInit, 8}; CORRADE_COMPARE(a->a, 5); CORRADE_COMPARE(ca->a, 8); @@ -458,7 +458,7 @@ void PointerTest::accessInvalid() { void PointerTest::reset() { { - Pointer a{InPlaceInit, 5}; + Pointer a{Corrade::InPlaceInit, 5}; CORRADE_VERIFY(a); CORRADE_COMPARE(a->a, 5); @@ -473,7 +473,7 @@ void PointerTest::reset() { void PointerTest::emplace() { { - Pointer a{InPlaceInit, 5}; + Pointer a{Corrade::InPlaceInit, 5}; CORRADE_VERIFY(a); CORRADE_COMPARE(a->a, 5); @@ -490,7 +490,7 @@ void PointerTest::emplace() { void PointerTest::release() { Immovable* ptr; { - Pointer a{InPlaceInit, 5}; + Pointer a{Corrade::InPlaceInit, 5}; CORRADE_VERIFY(a); CORRADE_COMPARE(a->a, 5); @@ -534,7 +534,7 @@ void PointerTest::emplaceConstructorExplicitInCopyInitialization() { static_cast(a); /* So this should too */ - Pointer b{InPlaceInit}; + Pointer b{Corrade::InPlaceInit}; Pointer c; c.emplace(); CORRADE_VERIFY(b); @@ -552,7 +552,7 @@ void PointerTest::copyConstructPlainStruct() { argument and fails miserably -- a{InPlaceInit, 3, 'a'} would in-place initialize them, which is fine and doesn't need workarounds */ const ExtremelyTrivial value{3, 'a'}; - Pointer a{InPlaceInit, value}; + Pointer a{Corrade::InPlaceInit, value}; CORRADE_COMPARE(a->a, 3); /* This copy-constructs new values -- emplace(4, 'b') would in-place @@ -573,7 +573,7 @@ void PointerTest::moveConstructPlainStruct() { to convert MoveOnlyStruct to int to initialize the first argument and fails miserably -- a{InPlaceInit, 3, 'a', nullptr} would in-place initialize them, which is fine and doesn't need workarounds */ - Pointer a{InPlaceInit, MoveOnlyStruct{3, 'a', nullptr}}; + Pointer a{Corrade::InPlaceInit, MoveOnlyStruct{3, 'a', nullptr}}; CORRADE_COMPARE(a->a, 3); /* This copy-constructs new values -- emplace(4, 'b', nullptr) would diff --git a/src/Corrade/Containers/Test/ScopeGuardTest.cpp b/src/Corrade/Containers/Test/ScopeGuardTest.cpp index e4ad49d6a..db5f3365a 100644 --- a/src/Corrade/Containers/Test/ScopeGuardTest.cpp +++ b/src/Corrade/Containers/Test/ScopeGuardTest.cpp @@ -57,13 +57,13 @@ ScopeGuardTest::ScopeGuardTest() { void ScopeGuardTest::constructNoCreate() { { - ScopeGuard e{NoCreate}; + ScopeGuard e{Corrade::NoCreate}; } /* Implicit construction from NoCreateT is not allowed, neither should be default construction (because such instance is too easy to create by accident but makes no sense, so prevent that) */ - CORRADE_VERIFY(!std::is_convertible::value); + CORRADE_VERIFY(!std::is_convertible::value); CORRADE_VERIFY(!std::is_default_constructible::value); } @@ -79,7 +79,7 @@ void ScopeGuardTest::constructMove() { ScopeGuard b = std::move(a); CORRADE_COMPARE(v, 0); - ScopeGuard c{NoCreate}; + ScopeGuard c{Corrade::NoCreate}; CORRADE_COMPARE(v, 0); c = std::move(a); diff --git a/src/Corrade/Containers/Test/StaticArrayTest.cpp b/src/Corrade/Containers/Test/StaticArrayTest.cpp index 84a068db2..7e7c24c2c 100644 --- a/src/Corrade/Containers/Test/StaticArrayTest.cpp +++ b/src/Corrade/Containers/Test/StaticArrayTest.cpp @@ -190,14 +190,14 @@ void StaticArrayTest::construct() { } void StaticArrayTest::constructDefaultInit() { - const StaticArray a{DefaultInit}; + const StaticArray a{Corrade::DefaultInit}; CORRADE_VERIFY(a); /* Values are random memory */ } void StaticArrayTest::constructValueInit() { - const StaticArray a{ValueInit}; + const StaticArray a{Corrade::ValueInit}; CORRADE_VERIFY(a); /* Values should be zero-initialized (same as the default constructor) */ @@ -307,10 +307,10 @@ void StaticArrayTest::resetCounters() { void StaticArrayTest::constructNoInit() { { - const Containers::StaticArray<5, Copyable> a{NoInit}; + const Containers::StaticArray<5, Copyable> a{Corrade::NoInit}; CORRADE_COMPARE(Copyable::constructed, 0); - const Containers::StaticArray<5, Copyable> b{DefaultInit}; + const Containers::StaticArray<5, Copyable> b{Corrade::DefaultInit}; CORRADE_COMPARE(Copyable::constructed, 5); } @@ -319,7 +319,7 @@ void StaticArrayTest::constructNoInit() { void StaticArrayTest::constructInPlaceInit() { const StaticArray a{1, 2, 3, 4, 5}; - const StaticArray b{InPlaceInit, 1, 2, 3, 4, 5}; + const StaticArray b{Corrade::InPlaceInit, 1, 2, 3, 4, 5}; CORRADE_COMPARE(a[0], 1); CORRADE_COMPARE(b[0], 1); @@ -339,7 +339,7 @@ void StaticArrayTest::constructInPlaceInitOneArgument() { } void StaticArrayTest::constructDirectInit() { - const StaticArray a{DirectInit, -37}; + const StaticArray a{Corrade::DirectInit, -37}; CORRADE_COMPARE(a[0], -37); CORRADE_COMPARE(a[1], -37); CORRADE_COMPARE(a[2], -37); @@ -350,7 +350,7 @@ void StaticArrayTest::constructDirectInit() { void StaticArrayTest::constructNonCopyable() { /* Can't use ValueInit because that apparently copy-constructs the array elements (huh?) */ - const Containers::StaticArray<5, Immovable> a{DefaultInit}; + const Containers::StaticArray<5, Immovable> a{Corrade::DefaultInit}; CORRADE_VERIFY(a); } @@ -361,7 +361,7 @@ void StaticArrayTest::constructNoImplicitConstructor() { int i; }; - const Containers::StaticArray<5, NoImplicitConstructor> a{Containers::DirectInit, 5}; + const Containers::StaticArray<5, NoImplicitConstructor> a{Corrade::DirectInit, 5}; CORRADE_VERIFY(a); CORRADE_COMPARE(a[0].i, 5); CORRADE_COMPARE(a[1].i, 5); @@ -369,7 +369,7 @@ void StaticArrayTest::constructNoImplicitConstructor() { CORRADE_COMPARE(a[3].i, 5); CORRADE_COMPARE(a[4].i, 5); - const Containers::StaticArray<5, NoImplicitConstructor> b{Containers::InPlaceInit, 1, 2, 3, 4, 5}; + const Containers::StaticArray<5, NoImplicitConstructor> b{Corrade::InPlaceInit, 1, 2, 3, 4, 5}; CORRADE_VERIFY(b); CORRADE_COMPARE(b[0].i, 1); CORRADE_COMPARE(b[1].i, 2); @@ -391,13 +391,13 @@ void StaticArrayTest::constructDirectReferences() { Reference(NonCopyable&) {} }; - const Containers::StaticArray<5, Reference> b{Containers::DirectInit, a}; + const Containers::StaticArray<5, Reference> b{Corrade::DirectInit, a}; CORRADE_VERIFY(b); } void StaticArrayTest::copy() { { - Containers::StaticArray<3, Copyable> a{Containers::InPlaceInit, 1, 2, 3}; + Containers::StaticArray<3, Copyable> a{Corrade::InPlaceInit, 1, 2, 3}; Containers::StaticArray<3, Copyable> b{a}; CORRADE_COMPARE(b[0].a, 1); @@ -432,7 +432,7 @@ void StaticArrayTest::copy() { void StaticArrayTest::move() { { - Containers::StaticArray<3, Movable> a{Containers::InPlaceInit, 1, 2, 3}; + Containers::StaticArray<3, Movable> a{Corrade::InPlaceInit, 1, 2, 3}; Containers::StaticArray<3, Movable> b{std::move(a)}; CORRADE_COMPARE(b[0].a, 1); @@ -730,7 +730,7 @@ void StaticArrayTest::accessConst() { } void StaticArrayTest::rvalueArrayAccess() { - CORRADE_COMPARE((StaticArray{DirectInit, 3})[2], 3); + CORRADE_COMPARE((StaticArray{Corrade::DirectInit, 3})[2], 3); } void StaticArrayTest::rangeBasedFor() { @@ -751,8 +751,8 @@ void StaticArrayTest::rangeBasedFor() { } void StaticArrayTest::slice() { - StaticArray a{InPlaceInit, 1, 2, 3, 4, 5}; - const StaticArray ac{InPlaceInit, 1, 2, 3, 4, 5}; + StaticArray a{Corrade::InPlaceInit, 1, 2, 3, 4, 5}; + const StaticArray ac{Corrade::InPlaceInit, 1, 2, 3, 4, 5}; ArrayView b = a.slice(1, 4); CORRADE_COMPARE(b.size(), 3); @@ -804,8 +804,8 @@ void StaticArrayTest::slice() { } void StaticArrayTest::slicePointer() { - StaticArray a{InPlaceInit, 1, 2, 3, 4, 5}; - const StaticArray ac{InPlaceInit, 1, 2, 3, 4, 5}; + StaticArray a{Corrade::InPlaceInit, 1, 2, 3, 4, 5}; + const StaticArray ac{Corrade::InPlaceInit, 1, 2, 3, 4, 5}; ArrayView b = a.slice(a + 1, a + 4); CORRADE_COMPARE(b.size(), 3); @@ -845,8 +845,8 @@ void StaticArrayTest::slicePointer() { } void StaticArrayTest::sliceToStatic() { - StaticArray a{InPlaceInit, 1, 2, 3, 4, 5}; - const StaticArray ac{InPlaceInit, 1, 2, 3, 4, 5}; + StaticArray a{Corrade::InPlaceInit, 1, 2, 3, 4, 5}; + const StaticArray ac{Corrade::InPlaceInit, 1, 2, 3, 4, 5}; Containers::StaticArrayView<3, int> b1 = a.slice<3>(1); CORRADE_COMPARE(b1[0], 2); @@ -900,8 +900,8 @@ void StaticArrayTest::sliceToStatic() { } void StaticArrayTest::sliceToStaticPointer() { - StaticArray a{InPlaceInit, 1, 2, 3, 4, 5}; - const StaticArray ac{InPlaceInit, 1, 2, 3, 4, 5}; + StaticArray a{Corrade::InPlaceInit, 1, 2, 3, 4, 5}; + const StaticArray ac{Corrade::InPlaceInit, 1, 2, 3, 4, 5}; Containers::StaticArrayView<3, int> b = a.slice<3>(a + 1); CORRADE_COMPARE(b[0], 2); @@ -972,7 +972,7 @@ void StaticArrayTest::emplaceConstructorExplicitInCopyInitialization() { static_cast(a); /* So this should too */ - Containers::StaticArray<3, ContainingExplicitDefaultWithImplicitConstructor> b{DirectInit}; + Containers::StaticArray<3, ContainingExplicitDefaultWithImplicitConstructor> b{Corrade::DirectInit}; CORRADE_COMPARE(b.size(), 3); } @@ -985,7 +985,7 @@ void StaticArrayTest::copyConstructPlainStruct() { /* This needs special handling on GCC 4.8, where T{b} (copy-construction) attempts to convert ExtremelyTrivial to int to initialize the first argument and fails miserably. */ - Containers::StaticArray<3, ExtremelyTrivial> a{DirectInit, 3, 'a'}; + Containers::StaticArray<3, ExtremelyTrivial> a{Corrade::DirectInit, 3, 'a'}; CORRADE_COMPARE(a.front().a, 3); /* This copy-constructs new values */ @@ -1017,7 +1017,7 @@ void StaticArrayTest::moveConstructPlainStruct() { /* This needs special handling on GCC 4.8, where T{std::move(b)} attempts to convert MoveOnlyStruct to int to initialize the first argument and fails miserably. */ - Containers::StaticArray<3, MoveOnlyStruct> a{DirectInit, 3, 'a', nullptr}; + Containers::StaticArray<3, MoveOnlyStruct> a{Corrade::DirectInit, 3, 'a', nullptr}; CORRADE_COMPARE(a.front().a, 3); /* This move-constructs new values */ diff --git a/src/Corrade/Containers/Test/StridedArrayViewTest.cpp b/src/Corrade/Containers/Test/StridedArrayViewTest.cpp index 93cbdc75a..287f55682 100644 --- a/src/Corrade/Containers/Test/StridedArrayViewTest.cpp +++ b/src/Corrade/Containers/Test/StridedArrayViewTest.cpp @@ -462,7 +462,7 @@ StridedArrayViewTest::StridedArrayViewTest() { void StridedArrayViewTest::dimensionsConstructDefault() { Size3D a1; - Size3D a2{ValueInit}; + Size3D a2{Corrade::ValueInit}; CORRADE_COMPARE(a1[0], 0); CORRADE_COMPARE(a1[1], 0); CORRADE_COMPARE(a1[2], 0); @@ -471,7 +471,7 @@ void StridedArrayViewTest::dimensionsConstructDefault() { CORRADE_COMPARE(a2[2], 0); constexpr Size3D ca1; - constexpr Size3D ca2{ValueInit}; + constexpr Size3D ca2{Corrade::ValueInit}; CORRADE_COMPARE(ca1[0], 0); CORRADE_COMPARE(ca1[1], 0); CORRADE_COMPARE(ca1[2], 0); @@ -480,10 +480,10 @@ void StridedArrayViewTest::dimensionsConstructDefault() { CORRADE_COMPARE(ca2[2], 0); CORRADE_VERIFY(std::is_nothrow_default_constructible::value); - CORRADE_VERIFY(std::is_nothrow_constructible::value); + CORRADE_VERIFY(std::is_nothrow_constructible::value); /* Implicit conversion from ValueInitT not allowed */ - CORRADE_VERIFY(!std::is_convertible::value); + CORRADE_VERIFY(!std::is_convertible::value); } void StridedArrayViewTest::dimensionsConstruct() { @@ -531,7 +531,7 @@ void StridedArrayViewTest::dimensionsConstructView() { void StridedArrayViewTest::dimensionsConstructNoInit() { Size3D a{1, 37, 4564}; - new(&a)Size3D{NoInit}; + new(&a)Size3D{Corrade::NoInit}; { #if defined(__GNUC__) && __GNUC__ >= 10 && __OPTIMIZE__ CORRADE_EXPECT_FAIL("GCC 10+ misoptimizes and overwrites the value."); @@ -541,10 +541,10 @@ void StridedArrayViewTest::dimensionsConstructNoInit() { CORRADE_COMPARE(a[2], 4564); } - CORRADE_VERIFY(std::is_nothrow_constructible::value); + CORRADE_VERIFY(std::is_nothrow_constructible::value); /* Implicit conversion from NoInitT not allowed */ - CORRADE_VERIFY(!std::is_convertible::value); + CORRADE_VERIFY(!std::is_convertible::value); } constexpr Size3D Sizes{34, 67, 98989}; diff --git a/src/Corrade/Containers/Test/StringTest.cpp b/src/Corrade/Containers/Test/StringTest.cpp index 2103bdf33..b71a23355 100644 --- a/src/Corrade/Containers/Test/StringTest.cpp +++ b/src/Corrade/Containers/Test/StringTest.cpp @@ -471,7 +471,7 @@ void StringTest::constructPointerSizeTooLarge() { } void StringTest::constructValueInit() { - String a{ValueInit, 35}; + String a{Corrade::ValueInit, 35}; CORRADE_VERIFY(!a.isSmall()); CORRADE_COMPARE(a.size(), 35); CORRADE_COMPARE(a.data()[0], '\0'); @@ -480,7 +480,7 @@ void StringTest::constructValueInit() { } void StringTest::constructValueInitSmall() { - String a{ValueInit, 10}; + String a{Corrade::ValueInit, 10}; CORRADE_VERIFY(a.isSmall()); CORRADE_VERIFY(!a.isEmpty()); CORRADE_COMPARE(a.size(), 10); @@ -500,14 +500,14 @@ void StringTest::constructValueInitTooLarge() { std::ostringstream out; Error redirectError{&out}; - String a{ValueInit, ~std::size_t{}}; + String a{Corrade::ValueInit, ~std::size_t{}}; CORRADE_COMPARE(out.str(), sizeof(std::size_t) == 4 ? "Containers::String: string expected to be smaller than 2^30 bytes, got 4294967295\n" : "Containers::String: string expected to be smaller than 2^62 bytes, got 18446744073709551615\n"); } void StringTest::constructDirectInit() { - String a{DirectInit, 35, 'X'}; + String a{Corrade::DirectInit, 35, 'X'}; CORRADE_VERIFY(!a.isSmall()); CORRADE_COMPARE(a.size(), 35); CORRADE_COMPARE(a.data()[0], 'X'); @@ -516,7 +516,7 @@ void StringTest::constructDirectInit() { } void StringTest::constructDirectInitSmall() { - String a{DirectInit, 10, 'X'}; + String a{Corrade::DirectInit, 10, 'X'}; CORRADE_VERIFY(a.isSmall()); CORRADE_VERIFY(!a.isEmpty()); CORRADE_COMPARE(a.size(), 10); @@ -536,14 +536,14 @@ void StringTest::constructDirectInitTooLarge() { std::ostringstream out; Error redirectError{&out}; - String a{DirectInit, ~std::size_t{}, 'X'}; + String a{Corrade::DirectInit, ~std::size_t{}, 'X'}; CORRADE_COMPARE(out.str(), sizeof(std::size_t) == 4 ? "Containers::String: string expected to be smaller than 2^30 bytes, got 4294967295\n" : "Containers::String: string expected to be smaller than 2^62 bytes, got 18446744073709551615\n"); } void StringTest::constructNoInit() { - String a{NoInit, 35}; + String a{Corrade::NoInit, 35}; CORRADE_VERIFY(!a.isSmall()); CORRADE_COMPARE(a.size(), 35); /* Contents can be just anything */ @@ -551,7 +551,7 @@ void StringTest::constructNoInit() { } void StringTest::constructNoInitSmall() { - String a{NoInit, 10}; + String a{Corrade::NoInit, 10}; CORRADE_VERIFY(a.isSmall()); CORRADE_VERIFY(!a.isEmpty()); CORRADE_COMPARE(a.size(), 10); @@ -570,7 +570,7 @@ void StringTest::constructNoInitTooLarge() { std::ostringstream out; Error redirectError{&out}; - String a{NoInit, ~std::size_t{}}; + String a{Corrade::NoInit, ~std::size_t{}}; CORRADE_COMPARE(out.str(), sizeof(std::size_t) == 4 ? "Containers::String: string expected to be smaller than 2^30 bytes, got 4294967295\n" : "Containers::String: string expected to be smaller than 2^62 bytes, got 18446744073709551615\n"); diff --git a/src/Corrade/CorradeMain.cpp b/src/Corrade/CorradeMain.cpp index a6243effb..59977dfbe 100644 --- a/src/Corrade/CorradeMain.cpp +++ b/src/Corrade/CorradeMain.cpp @@ -55,7 +55,7 @@ namespace { Containers::Array convertWideArgv(std::size_t argc, wchar_t** wargv, Containers::Array& storage) { /* Calculate total length of all arguments, save the relative offsets */ - Containers::Array argv{Containers::ValueInit, argc + 1}; + Containers::Array argv{ValueInit, argc + 1}; std::size_t totalSize = 0; for(std::size_t i = 0; i != argc; ++i) { totalSize += WideCharToMultiByte(CP_UTF8, 0, wargv[i], -1, nullptr, 0, nullptr, nullptr); diff --git a/src/Corrade/Interconnect/Test/Benchmark.cpp b/src/Corrade/Interconnect/Test/Benchmark.cpp index 0ae1c3523..a33f1a616 100644 --- a/src/Corrade/Interconnect/Test/Benchmark.cpp +++ b/src/Corrade/Interconnect/Test/Benchmark.cpp @@ -127,7 +127,7 @@ void Benchmark::destructBaseline() { } }; - Containers::Optional emitter{Containers::InPlaceInit}; + Containers::Optional emitter{InPlaceInit}; CORRADE_BENCHMARK(1) emitter = Containers::NullOpt; @@ -140,7 +140,7 @@ void Benchmark::destruct1kFunctions() { } }; - Containers::Optional emitter{Containers::InPlaceInit}; + Containers::Optional emitter{InPlaceInit}; for(std::size_t i = 0; i != 1000; ++i) connect(*emitter, &E::fire, freeFunctionSlot); @@ -156,7 +156,7 @@ void Benchmark::destruct1kMembersEmitterFirst() { } }; - Containers::Optional emitter{Containers::InPlaceInit}; + Containers::Optional emitter{InPlaceInit}; struct R: Receiver { int output = 0; @@ -184,7 +184,7 @@ void Benchmark::destruct1kMembersReceiverFirst() { void receive() { ++output; } }; - Containers::Optional receiver{Containers::InPlaceInit}; + Containers::Optional receiver{InPlaceInit}; for(std::size_t i = 0; i != 1000; ++i) connect(emitter, &E::fire, *receiver, &R::receive); diff --git a/src/Corrade/PluginManager/AbstractManager.cpp b/src/Corrade/PluginManager/AbstractManager.cpp index 7bd6a0d12..d09af87e5 100644 --- a/src/Corrade/PluginManager/AbstractManager.cpp +++ b/src/Corrade/PluginManager/AbstractManager.cpp @@ -240,9 +240,9 @@ AbstractManager::AbstractManager(std::string pluginInterface, const std::vector< AbstractManager::AbstractManager(std::string pluginInterface, std::string pluginMetadataSuffix): #endif #ifndef CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - _state{Containers::InPlaceInit, std::move(pluginInterface), std::move(pluginSuffix), std::move(pluginMetadataSuffix)} + _state{InPlaceInit, std::move(pluginInterface), std::move(pluginSuffix), std::move(pluginMetadataSuffix)} #else - _state{Containers::InPlaceInit, std::move(pluginInterface), std::move(pluginMetadataSuffix)} + _state{InPlaceInit, std::move(pluginInterface), std::move(pluginMetadataSuffix)} #endif { /* Add static plugins which have the same interface and don't have a diff --git a/src/Corrade/PluginManager/AbstractPlugin.cpp b/src/Corrade/PluginManager/AbstractPlugin.cpp index a139087d2..eba6b9341 100644 --- a/src/Corrade/PluginManager/AbstractPlugin.cpp +++ b/src/Corrade/PluginManager/AbstractPlugin.cpp @@ -58,16 +58,16 @@ void AbstractPlugin::initialize() {} void AbstractPlugin::finalize() {} -AbstractPlugin::AbstractPlugin(): _state{Containers::InPlaceInit} {} +AbstractPlugin::AbstractPlugin(): _state{InPlaceInit} {} -AbstractPlugin::AbstractPlugin(AbstractManager& manager, const std::string& plugin): _state{Containers::InPlaceInit} { +AbstractPlugin::AbstractPlugin(AbstractManager& manager, const std::string& plugin): _state{InPlaceInit} { _state->manager = &manager; _state->plugin = plugin; manager.registerInstance(plugin, *this, _state->metadata); _state->configuration = _state->metadata->configuration(); } -AbstractPlugin::AbstractPlugin(AbstractManager& manager): _state{Containers::InPlaceInit} { +AbstractPlugin::AbstractPlugin(AbstractManager& manager): _state{InPlaceInit} { _state->manager = &manager; } diff --git a/src/Corrade/PluginManager/Test/ManagerTest.cpp b/src/Corrade/PluginManager/Test/ManagerTest.cpp index ba531adad..51b495b2d 100644 --- a/src/Corrade/PluginManager/Test/ManagerTest.cpp +++ b/src/Corrade/PluginManager/Test/ManagerTest.cpp @@ -784,7 +784,7 @@ void ManagerTest::crossManagerDependenciesWrongDestructionOrder() { CORRADE_SKIP("CORRADE_NO_ASSERT defined, can't fully test assertions"); #endif - Containers::Optional> manager{Containers::InPlaceInit}; + Containers::Optional> manager{InPlaceInit}; PluginManager::Manager foodManager; foodManager.registerExternalManager(*manager); diff --git a/src/Corrade/Tags.h b/src/Corrade/Tags.h new file mode 100644 index 000000000..702b29570 --- /dev/null +++ b/src/Corrade/Tags.h @@ -0,0 +1,274 @@ +#ifndef Corrade_Tags_h +#define Corrade_Tags_h +/* + This file is part of Corrade. + + Copyright © 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, + 2017, 2018, 2019, 2020, 2021 + Vladimír Vondruš + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +/** @file + * @brief Tag type @ref Corrade::ValueInitT, @ref Corrade::DefaultInitT, @ref Corrade::NoInitT, @ref Corrade::DirectInitT, tag @ref Corrade::ValueInit, @ref Corrade::DefaultInit, @ref Corrade::NoInit, @ref Corrade::DirectInit + * @m_since_latest + */ + +#include "Corrade/configure.h" + +#ifdef CORRADE_BUILD_DEPRECATED +#include "Corrade/Utility/Macros.h" +#endif + +namespace Corrade { + +/** +@brief Default initialization tag type +@m_since_latest + +Used to distinguish construction with default initialization. The actual +meaning of "default" may vary, see documentation of a particular API using this +tag for a detailed behavior description. +@see @ref DefaultInit +*/ +/* Explicit constructor to avoid ambiguous calls when using {} */ +struct DefaultInitT { + #ifndef DOXYGEN_GENERATING_OUTPUT + struct Init{}; + constexpr explicit DefaultInitT(Init) {} + #endif +}; + +/** +@brief Value initialization tag type +@m_since_latest + +Used to distinguish construction with value initialization (builtin types are +zeroed out, others are default-constructed). +@see @ref ValueInit +*/ +/* Explicit constructor to avoid ambiguous calls when using {} */ +struct ValueInitT { + #ifndef DOXYGEN_GENERATING_OUTPUT + struct Init{}; + constexpr explicit ValueInitT(Init) {} + #endif +}; + +/** +@brief No initialization tag type +@m_since_latest + +Used to distinguish construction with no initialization at all, which leaves +the data with whatever random values the memory had before. +@see @ref NoInit, @ref NoCreateT +*/ +/* Explicit constructor to avoid ambiguous calls when using {} */ +struct NoInitT { + #ifndef DOXYGEN_GENERATING_OUTPUT + struct Init{}; + constexpr explicit NoInitT(Init) {} + #endif +}; + +/** +@brief No creation tag type +@m_since_latest + +Used to distinguish construction with initialization but not creation. Contrary +to @ref NoInitT this doesn't keep random values, but makes the instance empty +(usually equivalent to a moved-out state). +@see @ref NoCreate +*/ +/* Explicit constructor to avoid ambiguous calls when using {} */ +struct NoCreateT { + #ifndef DOXYGEN_GENERATING_OUTPUT + struct Init{}; + constexpr explicit NoCreateT(Init) {} + #endif +}; + +/** +@brief Direct initialization tag type +@m_since_latest + +Used to distinguish construction with direct initialization. +@see @ref DirectInit +*/ +/* Explicit constructor to avoid ambiguous calls when using {} */ +struct DirectInitT { + #ifndef DOXYGEN_GENERATING_OUTPUT + struct Init{}; + constexpr explicit DirectInitT(Init) {} + #endif +}; + +/** +@brief In-place initialization tag type +@m_since_latest + +Used to distinguish construction with in-place initialization. +@see @ref DirectInit +*/ +/* Explicit constructor to avoid ambiguous calls when using {} */ +struct InPlaceInitT { + #ifndef DOXYGEN_GENERATING_OUTPUT + struct Init{}; + constexpr explicit InPlaceInitT(Init) {} + #endif +}; + +/** +@brief Default initialization tag +@m_since_latest + +Use for construction with default initialization. The actual meaning of +"default" may vary, see documentation of a particular API using this tag for +a detailed behavior description. +*/ +constexpr DefaultInitT DefaultInit{DefaultInitT::Init{}}; + +/** +@brief Value initialization tag +@m_since_latest + +Use for construction using value initialization (builtin types are zeroed out, +others are default-constructed). +*/ +constexpr ValueInitT ValueInit{ValueInitT::Init{}}; + +/** +@brief No initialization tag +@m_since_latest + +Use for construction with no initialization at all. +*/ +constexpr NoInitT NoInit{NoInitT::Init{}}; + +/** +@brief No creation tag +@m_since_latest + +Use for construction with initialization, but keeping the instance empty +(usually equivalent to a moved-out state). +*/ +constexpr NoCreateT NoCreate{NoCreateT::Init{}}; + +/** +@brief Direct initialization tag +@m_since_latest + +Use for construction with direct initialization. +*/ +constexpr DirectInitT DirectInit{DirectInitT::Init{}}; + +/** +@brief In-place initialization tag +@m_since_latest + +Use for construction in-place. +*/ +constexpr InPlaceInitT InPlaceInit{InPlaceInitT::Init{}}; + +#ifdef CORRADE_BUILD_DEPRECATED +/* Deprecated aliases defined here and not in in Corrade/Containers/Tags.h + since most code relies on the header being included transitively and so the + aliases wouldn't be found if we'd switch to the new header everywhere */ + +namespace Containers { + +/** @brief @copybrief Corrade::DefaultInitT + * @m_deprecated_since_latest Use @ref Corrade::DefaultInitT instead. + */ +typedef CORRADE_DEPRECATED("use Corrade::DefaultInitT instead") Corrade::DefaultInitT DefaultInitT; + +/** @brief @copybrief Corrade::ValueInitT + * @m_deprecated_since_latest Use @ref Corrade::ValueInitT instead. + */ +typedef CORRADE_DEPRECATED("use Corrade::ValueInitT instead") Corrade::ValueInitT ValueInitT; + +/** @brief @copybrief Corrade::NoInitT + * @m_deprecated_since_latest Use @ref Corrade::NoInitT instead. + */ +typedef CORRADE_DEPRECATED("use Corrade::NoInitT instead") Corrade::NoInitT NoInitT; + +/** @brief @copybrief Corrade::NoCreateT + * @m_deprecated_since_latest Use @ref Corrade::NoCreateT instead. + */ +typedef CORRADE_DEPRECATED("use Corrade::NoCreateT instead") Corrade::NoCreateT NoCreateT; + +/** @brief @copybrief Corrade::DirectInitT + * @m_deprecated_since_latest Use @ref Corrade::DirectInitT instead. + */ +typedef CORRADE_DEPRECATED("use Corrade::DirectInitT instead") Corrade::DirectInitT DirectInitT; + +/** @brief @copybrief Corrade::InPlaceInitT + * @m_deprecated_since_latest Use @ref Corrade::InPlaceInitT instead. + */ +typedef CORRADE_DEPRECATED("use Corrade::InPlaceInitT instead") Corrade::InPlaceInitT InPlaceInitT; + +/** @brief @copybrief Corrade::DefaultInit + * @m_deprecated_since_latest Use @ref Corrade::DefaultInit instead. + * @todo when removing, clean up all Corrade::DefaultInit in Containers to be + * DefaultInit again + */ +constexpr CORRADE_DEPRECATED("use Corrade::DefaultInitT instead") Corrade::DefaultInitT DefaultInit{Corrade::DefaultInitT::Init{}}; + +/** @brief @copybrief Corrade::ValueInit + * @m_deprecated_since_latest Use @ref Corrade::ValueInit instead. + * @todo when removing, clean up all Corrade::ValueInit in Containers to be + * ValueInit again + */ +constexpr CORRADE_DEPRECATED("use Corrade::ValueInit instead") Corrade::ValueInitT ValueInit{Corrade::ValueInitT::Init{}}; + +/** @brief @copybrief Corrade::NoInit + * @m_deprecated_since_latest Use @ref Corrade::NoInit instead. + * @todo when removing, clean up all Corrade::NoInit in Containers to be + * NoInit again + */ +constexpr CORRADE_DEPRECATED("use Corrade::NoInit instead") Corrade::NoInitT NoInit{Corrade::NoInitT::Init{}}; + +/** @brief @copybrief Corrade::NoCreate + * @m_deprecated_since_latest Use @ref Corrade::NoCreate instead. + * @todo when removing, clean up all Corrade::NoCreate in Containers to be + * NoCreate again + */ +constexpr CORRADE_DEPRECATED("use Corrade::NoCreateT instead") Corrade::NoCreateT NoCreate{Corrade::NoCreateT::Init{}}; + +/** @brief @copybrief Corrade::DirectInit + * @m_deprecated_since_latest Use @ref Corrade::DirectInit instead. + * @todo when removing, clean up all Corrade::DirectInit in Containers to be + * DirectInit again + */ +constexpr CORRADE_DEPRECATED("use Corrade::DirectInitT instead") Corrade::DirectInitT DirectInit{Corrade::DirectInitT::Init{}}; + +/** @brief @copybrief Corrade::InPlaceInit + * @m_deprecated_since_latest Use @ref Corrade::InPlaceInit instead. + * @todo when removing, clean up all Corrade::InPlaceInit in Containers to be + * InPlaceInit again + */ +constexpr CORRADE_DEPRECATED("use Corrade::InPlaceInit instead") Corrade::InPlaceInitT InPlaceInit{Corrade::InPlaceInitT::Init{}}; + +} +#endif + +} + +#endif diff --git a/src/Corrade/Test/CMakeLists.txt b/src/Corrade/Test/CMakeLists.txt index 415c68bd0..2feb0a098 100644 --- a/src/Corrade/Test/CMakeLists.txt +++ b/src/Corrade/Test/CMakeLists.txt @@ -26,6 +26,8 @@ corrade_add_test(MainTest MainTest.cpp ARGUMENTS --arg-utf hýždě --arg-another šňůra) +# Prefixed with project name to avoid conflicts with TagsTest in Magnum +corrade_add_test(CorradeTagsTest TagsTest.cpp) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/configure.h) diff --git a/src/Corrade/Containers/Test/TagsTest.cpp b/src/Corrade/Test/TagsTest.cpp similarity index 93% rename from src/Corrade/Containers/Test/TagsTest.cpp rename to src/Corrade/Test/TagsTest.cpp index 4d6f3431d..372256214 100644 --- a/src/Corrade/Containers/Test/TagsTest.cpp +++ b/src/Corrade/Test/TagsTest.cpp @@ -24,10 +24,10 @@ DEALINGS IN THE SOFTWARE. */ -#include "Corrade/Containers/Tags.h" +#include "Corrade/Tags.h" #include "Corrade/TestSuite/Tester.h" -namespace Corrade { namespace Containers { namespace Test { namespace { +namespace Corrade { namespace Test { namespace { struct TagsTest: TestSuite::Tester { explicit TagsTest(); @@ -57,6 +57,6 @@ void TagsTest::inlineDefinition() { CORRADE_VERIFY(std::is_same::value); } -}}}} +}}} -CORRADE_TEST_MAIN(Corrade::Containers::Test::TagsTest) +CORRADE_TEST_MAIN(Corrade::Test::TagsTest) diff --git a/src/Corrade/TestSuite/Compare/Test/ContainerTest.cpp b/src/Corrade/TestSuite/Compare/Test/ContainerTest.cpp index 134120d85..21a3b4e89 100644 --- a/src/Corrade/TestSuite/Compare/Test/ContainerTest.cpp +++ b/src/Corrade/TestSuite/Compare/Test/ContainerTest.cpp @@ -155,9 +155,9 @@ void ContainerTest::floatingPoint() { } void ContainerTest::nonCopyableArray() { - Containers::Array a{Containers::InPlaceInit, {1, 2, 3, 4, 5}}; - Containers::Array b{Containers::InPlaceInit, {1, 2, 3, 4, 5}}; - Containers::Array c{Containers::InPlaceInit, {1, 2, 3, 5, 5}}; + Containers::Array a{InPlaceInit, {1, 2, 3, 4, 5}}; + Containers::Array b{InPlaceInit, {1, 2, 3, 4, 5}}; + Containers::Array c{InPlaceInit, {1, 2, 3, 5, 5}}; CORRADE_COMPARE(Comparator>>()(a, a), ComparisonStatusFlags{}); CORRADE_COMPARE(Comparator>>()(a, b), ComparisonStatusFlags{}); diff --git a/src/Corrade/TestSuite/Test/TesterTest.cpp b/src/Corrade/TestSuite/Test/TesterTest.cpp index 71d0f16ac..3e367db4a 100644 --- a/src/Corrade/TestSuite/Test/TesterTest.cpp +++ b/src/Corrade/TestSuite/Test/TesterTest.cpp @@ -1635,7 +1635,7 @@ void TesterTest::compareAsVarargs() { } void TesterTest::compareWithDereference() { - Containers::Optional comparator{Containers::InPlaceInit}; + Containers::Optional comparator{InPlaceInit}; CORRADE_COMPARE_WITH("hello", "olleh", *comparator); } diff --git a/src/Corrade/TestSuite/Tester.cpp b/src/Corrade/TestSuite/Tester.cpp index 58eb73323..b5fd45a8b 100644 --- a/src/Corrade/TestSuite/Tester.cpp +++ b/src/Corrade/TestSuite/Tester.cpp @@ -950,7 +950,7 @@ Utility::Debug Tester::Printer::debug() { return Debug{&_data->out, Debug::Flag::NoNewlineAtTheEnd}; } -Tester::Printer::Printer(): _data{Containers::InPlaceInit} {} +Tester::Printer::Printer(): _data{InPlaceInit} {} Tester::Printer::~Printer() = default; diff --git a/src/Corrade/Utility/Arguments.cpp b/src/Corrade/Utility/Arguments.cpp index 4774300aa..22c52cde2 100644 --- a/src/Corrade/Utility/Arguments.cpp +++ b/src/Corrade/Utility/Arguments.cpp @@ -225,8 +225,8 @@ Arguments& Arguments::addArgument(std::string key) { _flags &= ~InternalFlag::Parsed; std::string helpKey = key; - arrayAppend(_entries, Containers::InPlaceInit, Type::Argument, '\0', std::move(key), std::move(helpKey), std::string(), _values.size()); - arrayAppend(_values, Containers::InPlaceInit); + arrayAppend(_entries, InPlaceInit, Type::Argument, '\0', std::move(key), std::move(helpKey), std::string(), _values.size()); + arrayAppend(_values, InPlaceInit); return *this; } @@ -252,8 +252,8 @@ Arguments& Arguments::addArrayArgument(std::string key) { _arrayArgument = _entries.size(); std::string helpKey = key; - arrayAppend(_entries, Containers::InPlaceInit, Type::ArrayArgument, '\0', std::move(key), std::move(helpKey), std::string(), _arrayValues.size()); - arrayAppend(_arrayValues, Containers::InPlaceInit); + arrayAppend(_entries, InPlaceInit, Type::ArrayArgument, '\0', std::move(key), std::move(helpKey), std::string(), _arrayValues.size()); + arrayAppend(_arrayValues, InPlaceInit); return *this; } @@ -272,8 +272,8 @@ Arguments& Arguments::addNamedArgument(char shortKey, std::string key) { _flags &= ~InternalFlag::Parsed; std::string helpKey = key; - arrayAppend(_entries, Containers::InPlaceInit, Type::NamedArgument, shortKey, std::move(key), std::move(helpKey), std::string(), _values.size()); - arrayAppend(_values, Containers::InPlaceInit); + arrayAppend(_entries, InPlaceInit, Type::NamedArgument, shortKey, std::move(key), std::move(helpKey), std::string(), _values.size()); + arrayAppend(_values, InPlaceInit); return *this; } @@ -292,7 +292,7 @@ void Arguments::addOptionInternal(const char shortKey, std::string key, std::str then ask for values without parsing again */ _flags &= ~InternalFlag::Parsed; - arrayAppend(_entries, Containers::InPlaceInit, type, shortKey, std::move(key), std::move(helpKey), std::move(defaultValue), id); + arrayAppend(_entries, InPlaceInit, type, shortKey, std::move(key), std::move(helpKey), std::move(defaultValue), id); } Arguments& Arguments::addOption(const char shortKey, std::string key, std::string defaultValue) { @@ -309,7 +309,7 @@ Arguments& Arguments::addOption(const char shortKey, std::string key, std::strin } addOptionInternal(shortKey, std::move(key), std::move(helpKey), std::move(defaultValue), Type::Option, _values.size(), "Utility::Arguments::addOption():"); - arrayAppend(_values, Containers::InPlaceInit); + arrayAppend(_values, InPlaceInit); return *this; } @@ -327,7 +327,7 @@ Arguments& Arguments::addArrayOption(const char shortKey, std::string key) { } addOptionInternal(shortKey, std::move(key), std::move(helpKey), {}, Type::ArrayOption, _arrayValues.size(), "Utility::Arguments::addArrayOption():"); - arrayAppend(_arrayValues, Containers::InPlaceInit); + arrayAppend(_arrayValues, InPlaceInit); return *this; } @@ -373,8 +373,8 @@ Arguments& Arguments::addFinalOptionalArgument(std::string key, std::string defa _finalOptionalArgument = _entries.size(); std::string helpKey = key; - arrayAppend(_entries, Containers::InPlaceInit, Type::Argument, '\0', std::move(key), std::move(helpKey), std::move(defaultValue), _values.size()); - arrayAppend(_values, Containers::InPlaceInit); + arrayAppend(_entries, InPlaceInit, Type::Argument, '\0', std::move(key), std::move(helpKey), std::move(defaultValue), _values.size()); + arrayAppend(_values, InPlaceInit); return *this; } @@ -393,7 +393,7 @@ Arguments& Arguments::addSkippedPrefix(std::string prefix, std::string help) { `--prefix` */ prefix += '-'; - arrayAppend(_skippedPrefixes, Containers::InPlaceInit, std::move(prefix), std::move(help)); + arrayAppend(_skippedPrefixes, InPlaceInit, std::move(prefix), std::move(help)); return *this; } @@ -587,7 +587,7 @@ bool Arguments::tryParse(const int argc, const char** const argv) { _values[valueFor->id] = argv[i] + shortOptionPackOffset; } else if(valueFor->type == Type::ArrayOption) { CORRADE_INTERNAL_ASSERT(valueFor->id < _arrayValues.size()); - arrayAppend(_arrayValues[valueFor->id], Containers::InPlaceInit, argv[i] + shortOptionPackOffset); + arrayAppend(_arrayValues[valueFor->id], InPlaceInit, argv[i] + shortOptionPackOffset); } else CORRADE_INTERNAL_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */ /* The value always eats everything until the end, so there's @@ -791,7 +791,7 @@ bool Arguments::tryParse(const int argc, const char** const argv) { last one, move to the next entry in the following iteration. */ } else { CORRADE_INTERNAL_ASSERT(e->type == Type::ArrayArgument); - arrayAppend(_arrayValues[e->id], Containers::InPlaceInit, argumentValue); + arrayAppend(_arrayValues[e->id], InPlaceInit, argumentValue); if(!--arrayArgumentCount) ++e; } } diff --git a/src/Corrade/Utility/Test/AlgorithmsTest.cpp b/src/Corrade/Utility/Test/AlgorithmsTest.cpp index 065354b64..ace43d0bc 100644 --- a/src/Corrade/Utility/Test/AlgorithmsTest.cpp +++ b/src/Corrade/Utility/Test/AlgorithmsTest.cpp @@ -252,10 +252,8 @@ template void AlgorithmsTest::copyStrided1D() { setTestCaseTemplateName(TypeName::name()); /* Enough so even sparse variants fit */ - Containers::Array srcData{Containers::NoInit, - std::size_t(data.srcStride*5*2)}; - Containers::Array dstData{Containers::NoInit, - std::size_t(data.dstStride*5*2)}; + Containers::Array srcData{NoInit, std::size_t(data.srcStride*5*2)}; + Containers::Array dstData{NoInit, std::size_t(data.dstStride*5*2)}; Containers::StridedArrayView1D src{srcData, 5, std::ptrdiff_t(data.srcStride*sizeof(T))}; Containers::StridedArrayView1D dst{dstData, 5, std::ptrdiff_t(data.dstStride*sizeof(T))}; @@ -278,10 +276,8 @@ template void AlgorithmsTest::copyStrided2D() { setTestCaseTemplateName(TypeName::name()); /* Enough so even sparse variants fit */ - Containers::Array srcData{Containers::NoInit, - std::size_t(data.srcStride[0]*3*2)}; - Containers::Array dstData{Containers::NoInit, - std::size_t(data.dstStride[0]*3*2)}; + Containers::Array srcData{NoInit, std::size_t(data.srcStride[0]*3*2)}; + Containers::Array dstData{NoInit, std::size_t(data.dstStride[0]*3*2)}; auto srcStride = data.srcStride; for(auto& i: srcStride) i *= sizeof(T); @@ -316,10 +312,8 @@ template void AlgorithmsTest::copyStrided3D() { setTestCaseTemplateName(TypeName::name()); /* Enough so even sparse variants fit */ - Containers::Array srcData{Containers::NoInit, - std::size_t(data.srcStride[0]*7*2)}; - Containers::Array dstData{Containers::NoInit, - std::size_t(data.dstStride[0]*7*2)}; + Containers::Array srcData{NoInit, std::size_t(data.srcStride[0]*7*2)}; + Containers::Array dstData{NoInit, std::size_t(data.dstStride[0]*7*2)}; auto srcStride = data.srcStride; for(auto& i: srcStride) i *= sizeof(T); @@ -356,10 +350,8 @@ template void AlgorithmsTest::copyStrided4D() { setTestCaseTemplateName(TypeName::name()); /* Enough so even sparse variants fit */ - Containers::Array srcData{Containers::NoInit, - std::size_t(data.srcStride[0]*2*2)}; - Containers::Array dstData{Containers::NoInit, - std::size_t(data.dstStride[0]*2*2)}; + Containers::Array srcData{NoInit, std::size_t(data.srcStride[0]*2*2)}; + Containers::Array dstData{NoInit, std::size_t(data.dstStride[0]*2*2)}; auto srcStride = data.srcStride; for(auto& i: srcStride) i *= sizeof(T); diff --git a/src/Corrade/Utility/Test/DirectoryTest.cpp b/src/Corrade/Utility/Test/DirectoryTest.cpp index a2d4330b1..32acf3fe2 100644 --- a/src/Corrade/Utility/Test/DirectoryTest.cpp +++ b/src/Corrade/Utility/Test/DirectoryTest.cpp @@ -1285,7 +1285,7 @@ void DirectoryTest::prepareFileToCopy() { if(Directory::exists(Directory::join(_writeTestDir, "copySource.dat"))) return; - Containers::Array data{Containers::NoInit, 150000}; + Containers::Array data{NoInit, 150000}; for(std::size_t i = 0; i != data.size(); ++i) data[i] = 4678641 + i; Directory::write(Directory::join(_writeTestDir, "copySource.dat"), data); @@ -1353,7 +1353,7 @@ void DirectoryTest::prepareFileToBenchmarkCopy() { return; /* Append a megabyte file 50 times to create a 50MB file */ - Containers::Array data{Containers::ValueInit, 256*1024}; + Containers::Array data{ValueInit, 256*1024}; for(std::size_t i = 0; i != data.size(); ++i) data[i] = 4678641 + i; for(std::size_t i = 0; i != 50; ++i) @@ -1453,8 +1453,7 @@ void DirectoryTest::mapRead() { { const auto mappedFile = Directory::mapRead(Directory::join(_testDir, "file")); CORRADE_COMPARE_AS(Containers::ArrayView(mappedFile), - (Containers::Array{Containers::InPlaceInit, - {'\xCA', '\xFE', '\xBA', '\xBE', '\x0D', '\x0A', '\x00', '\xDE', '\xAD', '\xBE', '\xEF'}}), + Containers::arrayView({'\xCA', '\xFE', '\xBA', '\xBE', '\x0D', '\x0A', '\x00', '\xDE', '\xAD', '\xBE', '\xEF'}), TestSuite::Compare::Container); } #else @@ -1480,8 +1479,7 @@ void DirectoryTest::mapReadUtf8() { { const auto mappedFile = Directory::mapRead(Directory::join(_testDirUtf8, "hýždě")); CORRADE_COMPARE_AS(Containers::ArrayView(mappedFile), - (Containers::Array{Containers::InPlaceInit, - {'\xCA', '\xFE', '\xBA', '\xBE', '\x0D', '\x0A', '\x00', '\xDE', '\xAD', '\xBE', '\xEF'}}), + Containers::arrayView({'\xCA', '\xFE', '\xBA', '\xBE', '\x0D', '\x0A', '\x00', '\xDE', '\xAD', '\xBE', '\xEF'}), TestSuite::Compare::Container); } #else