diff options
author | Felix Thomasmathibalan <felixjohnny.thomasmathibalan@arm.com> | 2023-09-27 17:46:17 +0100 |
---|---|---|
committer | felixjohnny.thomasmathibalan <felixjohnny.thomasmathibalan@arm.com> | 2023-09-28 12:08:05 +0000 |
commit | afd38f0c617d6f89b2b4532c6c44f116617e2b6f (patch) | |
tree | 03bc7d5a762099989b16a656fa8d397b490ed70e /support/DeepCopy.h | |
parent | bdcb4c148ee2fdeaaddf4cf1e57bbb0de02bb894 (diff) | |
download | ComputeLibrary-afd38f0c617d6f89b2b4532c6c44f116617e2b6f.tar.gz |
Apply clang-format on repository
Code is formatted as per a revised clang format configuration
file(not part of this delivery). Version 14.0.6 is used.
Exclusion List:
- files with .cl extension
- files that are not strictly C/C++ (e.g. Android.bp, Sconscript ...)
And the following directories
- compute_kernel_writer/validation/
- tests/
- include/
- src/core/NEON/kernels/convolution/
- src/core/NEON/kernels/arm_gemm/
- src/core/NEON/kernels/arm_conv/
- data/
There will be a follow up for formatting of .cl files and the
files under tests/ and compute_kernel_writer/validation/.
Signed-off-by: Felix Thomasmathibalan <felixjohnny.thomasmathibalan@arm.com>
Change-Id: Ib7eb1fcf4e7537b9feaefcfc15098a804a3fde0a
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/10391
Benchmark: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Gunes Bayir <gunes.bayir@arm.com>
Diffstat (limited to 'support/DeepCopy.h')
-rw-r--r-- | support/DeepCopy.h | 56 |
1 files changed, 20 insertions, 36 deletions
diff --git a/support/DeepCopy.h b/support/DeepCopy.h index 0117897901..c0279284c0 100644 --- a/support/DeepCopy.h +++ b/support/DeepCopy.h @@ -40,9 +40,8 @@ namespace template <typename Base, typename Derived> Base *default_polymorphic_copy(const Base *ptr) { - static_assert(std::is_base_of<Base, Derived>::value, - "Derived is not a specialization of Base"); - if(ptr == nullptr) + static_assert(std::is_base_of<Base, Derived>::value, "Derived is not a specialization of Base"); + if (ptr == nullptr) { return nullptr; } @@ -62,25 +61,18 @@ class deep_unique_ptr public: using CopyFunc = std::function<Base *(const Base *)>; - deep_unique_ptr(std::nullptr_t val = nullptr) noexcept - : _val{ val }, - _copy{} + deep_unique_ptr(std::nullptr_t val = nullptr) noexcept : _val{val}, _copy{} { } template <typename Derived, typename CopyFuncDerived> - deep_unique_ptr(Derived *value, const CopyFuncDerived ©) noexcept - : _val{ value }, - _copy{ std::move(copy) } + deep_unique_ptr(Derived *value, const CopyFuncDerived ©) noexcept : _val{value}, _copy{std::move(copy)} { - static_assert(std::is_base_of<Base, Derived>::value, - "Derived is not a specialization of Base"); - static_assert( - std::is_constructible<CopyFunc, CopyFuncDerived>::value, - "CopyFuncDerived is not valid for a copy functor"); + static_assert(std::is_base_of<Base, Derived>::value, "Derived is not a specialization of Base"); + static_assert(std::is_constructible<CopyFunc, CopyFuncDerived>::value, + "CopyFuncDerived is not valid for a copy functor"); } - deep_unique_ptr(const deep_unique_ptr<Base> &ptr) - : deep_unique_ptr(ptr.clone()) + deep_unique_ptr(const deep_unique_ptr<Base> &ptr) : deep_unique_ptr(ptr.clone()) { } deep_unique_ptr &operator=(const deep_unique_ptr<Base> &ptr) @@ -90,7 +82,7 @@ public: return *this; } - deep_unique_ptr(deep_unique_ptr<Base> &&ptr) = default; + deep_unique_ptr(deep_unique_ptr<Base> &&ptr) = default; deep_unique_ptr &operator=(deep_unique_ptr<Base> &&ptr) = default; ~deep_unique_ptr() = default; friend void swap(deep_unique_ptr &ptr0, deep_unique_ptr<Base> &ptr1) noexcept @@ -135,11 +127,11 @@ public: bool operator==(const deep_unique_ptr<Base> &rhs) const { - if(rhs.get() == nullptr && _val == nullptr) + if (rhs.get() == nullptr && _val == nullptr) { return true; } - else if(rhs.get() == nullptr || _val == nullptr) + else if (rhs.get() == nullptr || _val == nullptr) { return false; } @@ -152,9 +144,9 @@ public: private: deep_unique_ptr clone() const { - return { _copy(_val.get()), CopyFunc(_copy) }; + return {_copy(_val.get()), CopyFunc(_copy)}; } - std::unique_ptr<Base> _val{ nullptr }; + std::unique_ptr<Base> _val{nullptr}; CopyFunc _copy{}; }; @@ -170,34 +162,26 @@ private: template <typename Base, typename Derived, typename CopyFunc> deep_unique_ptr<Base> make_deep_unique(Derived &&temp, CopyFunc copy) { - return - { - new Derived(std::move(temp)), - CopyFunc{ std::move(copy) } - }; + return {new Derived(std::move(temp)), CopyFunc{std::move(copy)}}; } template <typename Base, typename Derived> deep_unique_ptr<Base> make_deep_unique(Derived &&temp) { - static_assert(std::is_base_of<Base, Derived>::value, - "Derived is not a specialization of Base"); + static_assert(std::is_base_of<Base, Derived>::value, "Derived is not a specialization of Base"); - return make_deep_unique<Base, Derived>( - std::move(temp), default_polymorphic_copy<Base, Derived>); + return make_deep_unique<Base, Derived>(std::move(temp), default_polymorphic_copy<Base, Derived>); } template <typename Base, typename Derived, typename... Args> -deep_unique_ptr<Base> make_deep_unique(Args &&... args) +deep_unique_ptr<Base> make_deep_unique(Args &&...args) { - static_assert(std::is_constructible<Derived, Args...>::value, - "Cannot instantiate Derived from arguments"); + static_assert(std::is_constructible<Derived, Args...>::value, "Cannot instantiate Derived from arguments"); - return make_deep_unique<Base, Derived>( - std::move(Derived{ std::forward<Args>(args)... })); + return make_deep_unique<Base, Derived>(std::move(Derived{std::forward<Args>(args)...})); } } // namespace memory } // namespace utils } // namespace arm_compute -#endif // ARM_COMPUTE_MISC_ITERABLE_H
\ No newline at end of file +#endif // ARM_COMPUTE_MISC_ITERABLE_H |