diff --git a/octa/memory.h b/octa/memory.h index fbd3f71..31b011d 100644 --- a/octa/memory.h +++ b/octa/memory.h @@ -431,6 +431,31 @@ namespace octa { T *p_ptr; D p_del; }; + + template struct __OctaBoxIf { + typedef Box __OctaBox; + }; + + template struct __OctaBoxIf { + typedef Box __OctaBoxUnknownSize; + }; + + template struct __OctaBoxIf { + typedef void __OctaBoxKnownSize; + }; + + template + typename __OctaBoxIf::__OctaBox make_box(A &&...args) { + return Box(new T(forward(args)...)); + } + + template + typename __OctaBoxIf::__OctaBoxUnknownSize make_box(size_t n) { + return Box(new RemoveExtent[n]()); + } + + template + typename __OctaBoxIf::__OctaBoxKnownSize make_box(A &&...args) = delete; } #endif \ No newline at end of file