From d0ae8b8ac8a371fd552c46d4b3be3db8628a5ade Mon Sep 17 00:00:00 2001 From: Moritz Pflanzer Date: Thu, 29 Jun 2017 14:51:57 +0100 Subject: COMPMID-417: Extract common toolchain support file The support file is needed as Android toolchains are missing some C++11 functions. It further includes functions that have been introduced in C++14 but which we already need. Eventually the support file might become unnecessary if the Android compilers improve and we switch to C++14. Change-Id: Ib5ec506f1a17c78149c315ab2096b901b852c180 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/79247 Reviewed-by: Georgios Pinitas Tested-by: Kaizen Reviewed-by: Pablo Tello --- arm_compute/core/CL/CLHelpers.h | 5 +++-- arm_compute/core/Helpers.h | 40 ---------------------------------------- arm_compute/runtime/Array.h | 4 ++-- 3 files changed, 5 insertions(+), 44 deletions(-) (limited to 'arm_compute') diff --git a/arm_compute/core/CL/CLHelpers.h b/arm_compute/core/CL/CLHelpers.h index 26253e3f38..7b3af33fee 100644 --- a/arm_compute/core/CL/CLHelpers.h +++ b/arm_compute/core/CL/CLHelpers.h @@ -26,6 +26,7 @@ #include "arm_compute/core/CL/OpenCL.h" #include "arm_compute/core/Helpers.h" +#include "support/ToolchainSupport.h" #include @@ -70,7 +71,7 @@ const std::string &string_from_target(GPUTarget target); template std::unique_ptr create_configure_kernel(T &&... args) { - std::unique_ptr k = arm_compute::cpp14::make_unique(); + std::unique_ptr k = arm_compute::support::cpp14::make_unique(); k->configure(std::forward(args)...); return k; } @@ -82,7 +83,7 @@ std::unique_ptr create_configure_kernel(T &&... args) template std::unique_ptr create_kernel() { - std::unique_ptr k = arm_compute::cpp14::make_unique(); + std::unique_ptr k = arm_compute::support::cpp14::make_unique(); return k; } diff --git a/arm_compute/core/Helpers.h b/arm_compute/core/Helpers.h index 07318eaf7a..dfcca96eec 100644 --- a/arm_compute/core/Helpers.h +++ b/arm_compute/core/Helpers.h @@ -46,46 +46,6 @@ class IKernel; class ITensor; class ITensorInfo; -namespace cpp14 -{ -template -struct _Unique_if -{ - typedef std::unique_ptr _Single_object; -}; - -template -struct _Unique_if -{ - typedef std::unique_ptr _Unknown_bound; -}; - -template -struct _Unique_if -{ - typedef void _Known_bound; -}; - -template -typename _Unique_if::_Single_object -make_unique(Args &&... args) -{ - return std::unique_ptr(new T(std::forward(args)...)); -} - -template -typename _Unique_if::_Unknown_bound -make_unique(size_t n) -{ - typedef typename std::remove_extent::type U; - return std::unique_ptr(new U[n]()); -} - -template -typename _Unique_if::_Known_bound -make_unique(Args &&...) = delete; -} - template struct enable_bitwise_ops { diff --git a/arm_compute/runtime/Array.h b/arm_compute/runtime/Array.h index c8a240e428..61e0953edd 100644 --- a/arm_compute/runtime/Array.h +++ b/arm_compute/runtime/Array.h @@ -24,9 +24,9 @@ #ifndef __ARM_COMPUTE_ARRAY_H__ #define __ARM_COMPUTE_ARRAY_H__ -#include "arm_compute/core/Helpers.h" #include "arm_compute/core/IArray.h" #include "arm_compute/core/Types.h" +#include "support/ToolchainSupport.h" #include @@ -47,7 +47,7 @@ public: * @param[in] max_num_values Maximum number of values the array will be able to stored */ Array(size_t max_num_values) - : IArray(max_num_values), _values(arm_compute::cpp14::make_unique(max_num_values)) + : IArray(max_num_values), _values(arm_compute::support::cpp14::make_unique(max_num_values)) { } -- cgit v1.2.1