aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/graph
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2018-12-12 19:01:46 +0000
committerGeorgios Pinitas <georgios.pinitas@arm.com>2018-12-13 10:42:21 +0000
commit3ba0ab113cd81705a3e5962ba807f30656987935 (patch)
tree9fb587dcb8b0c14aeeaf261bff340a95841ff85c /arm_compute/graph
parent05045c1e052dbba4e44bf0bb8ead3e9b5220d04e (diff)
downloadComputeLibrary-3ba0ab113cd81705a3e5962ba807f30656987935.tar.gz
COMPMID-1710: Avoid undefined behavior in GCC 8.2
Undefined behavior when pushing object which contain unique_ptr to a vector container. Vector dynamic resizing was making all the unique_ptr members of the inserted objects up to this point invalid. As a workaround, memory is reserved to avoid vector reallocation. Change-Id: I74f7641a7f36981ebe51720a924b865bb7f54c91 Reviewed-on: https://review.mlplatform.org/390 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Pablo Marquez <pablo.tello@arm.com>
Diffstat (limited to 'arm_compute/graph')
-rw-r--r--arm_compute/graph/Workload.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/arm_compute/graph/Workload.h b/arm_compute/graph/Workload.h
index e9368eefd0..682b08d88d 100644
--- a/arm_compute/graph/Workload.h
+++ b/arm_compute/graph/Workload.h
@@ -69,6 +69,20 @@ public:
*/
struct ExecutionTask
{
+ ExecutionTask(std::unique_ptr<arm_compute::IFunction> &&f, INode *n)
+ : task(std::move(f)), node(n)
+ {
+ }
+ /** Prevent instances of this class from being copied (As this class contains pointers) */
+ ExecutionTask(const ExecutionTask &) = delete;
+ /** Prevent instances of this class from being copied (As this class contains pointers) */
+ ExecutionTask &operator=(const ExecutionTask &) = delete;
+ /** Default Move Constructor. */
+ ExecutionTask(ExecutionTask &&) noexcept = default;
+ /** Default move assignment operator */
+ ExecutionTask &operator=(ExecutionTask &&) noexcept = default;
+ /** Default destructor */
+ ~ExecutionTask() = default;
// TODO (geopin01) : Support vector of functions?
std::unique_ptr<arm_compute::IFunction> task = {}; /**< Task to execute */
INode *node = {}; /**< Node bound to this workload */