BaseDim* BaseDim::clone() const { // get sub-class to return a cloned object BaseDim* o = clone_impl(); // fill in operator for cloned object o->d_operator = d_operator; // now clone any attached operand dimension if (d_operand) o->d_operand = d_operand->clone(); return o; }
%struct_prefix% { public: // Contructors %struct_name% () : handle_ (nullptr), buffer_ {} {} template <typename T> %struct_name% (T value) : handle_ (nullptr), buffer_ {} { handle_ = clone_impl(std::forward<T>(value), buffer_); } %struct_name% (const %struct_name% & rhs) : handle_ (nullptr), buffer_ {} { if (rhs.handle_) handle_ = rhs.handle_->clone_into(buffer_); } %struct_name% (%struct_name% && rhs) noexcept : handle_ (nullptr), buffer_ {} { swap(rhs.handle_, rhs.buffer_); } // Assignment template <typename T> %struct_name% & operator= (T value)
%struct_prefix% { public: // Contructors %struct_name% () : handle_ (nullptr), buffer_ {} {} template <typename T> %struct_name% (T value) : handle_ (nullptr), buffer_ {} { handle_ = clone_impl(std::move(value), buffer_); } %struct_name% (const %struct_name% & rhs) : handle_ (nullptr), buffer_ {} { if (rhs.handle_) handle_ = rhs.handle_->clone_into(buffer_); } %struct_name% (%struct_name% && rhs) noexcept : handle_ (nullptr), buffer_ {} { swap(rhs.handle_, rhs.buffer_); } // Assignment template <typename T> %struct_name% & operator= (T value)
iMarshaler* clone (void) const { return clone_impl(); }
/// Creates a deep copy of pipe object. // // (L1R)--[LPipe(this)R]-----(L2R) (L1R)--[LPipe(this)R]--(L2R) // ^ ==> | // +--(L3R)(clone(_, this) +----[LPipe(clon)R] (L3R) this_uptr_t clone(std::size_t new_id, left_vertex_ptr_t* const vertex_ptr) const { return clone_impl(new_id, vertex_ptr); }