mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-20 12:26:10 +01:00
Use CATCH_FORWARD in Detail::make_unique
This commit is contained in:
parent
77c7e9803e
commit
23f0d94b4f
@ -11,6 +11,8 @@
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include <catch2/internal/catch_move_and_forward.hpp>
|
||||||
|
|
||||||
#if defined(__clang__) && defined(__has_attribute)
|
#if defined(__clang__) && defined(__has_attribute)
|
||||||
# if __has_attribute(trivial_abi)
|
# if __has_attribute(trivial_abi)
|
||||||
# define TRIVIAL_ABI [[clang::trivial_abi]]
|
# define TRIVIAL_ABI [[clang::trivial_abi]]
|
||||||
@ -116,11 +118,7 @@ namespace Detail {
|
|||||||
|
|
||||||
template <typename T, typename... Args>
|
template <typename T, typename... Args>
|
||||||
unique_ptr<T> make_unique(Args&&... args) {
|
unique_ptr<T> make_unique(Args&&... args) {
|
||||||
// static_cast<Args&&> does the same thing as std::forward in
|
return unique_ptr<T>(new T(CATCH_FORWARD(args)...));
|
||||||
// this case, but does not require including big header (<utility>)
|
|
||||||
// and compiles faster thanks to not requiring template instantiation
|
|
||||||
// and overload resolution
|
|
||||||
return unique_ptr<T>(new T(static_cast<Args&&>(args)...));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user