[foundation] Do NOT allow copy/move on OwnedRegion (#299)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Mon, 4 Jun 2018 07:09:51 +0000 (16:09 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Mon, 4 Jun 2018 07:09:51 +0000 (16:09 +0900)
As its name suggestes, OwnedRegion should not be copied.

OwnedRegion should be moveable simialrly as std::unique_ptr<T>,
but the current implementation sets '_base' field as const field,
so it is impossible to implement move constructor.

As a workaround, this commit  disables move on Owned Region
temporarily.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
libs/foundation/include/nncc/foundation/OwnedRegion.h

index 2d8f463..0451996 100644 (file)
@@ -17,6 +17,12 @@ public:
   }
 
 public:
+  // Copy and move is not allowed
+  // TODO Allow move
+  OwnedRegion(const OwnedRegion &) = delete;
+  OwnedRegion(OwnedRegion &&r) = delete;
+
+public:
   ~OwnedRegion() { delete[] _base; }
 
 public: