Iroha - A simple, decentralized ledger http://iroha.tech
Cloneable< T > Class Template Referenceabstract

#include "cloneable.hpp"

Collaboration diagram for Cloneable< T >:
Collaboration graph

Public Types

using base_type = T

Public Member Functions

virtual ~Cloneable ()=default

Protected Member Functions

virtual T * clone () const =0


template<typename X >
std::unique_ptr< X > clone (const X &)

Detailed Description

template<typename T>
class Cloneable< T >

Copyright Soramitsu Co., Ltd. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 Functions and interface for creation cloneable classes with smart pointers.

Usage: struct Base : object::cloneable<Base> { // ... other methods };

struct Derived : Base { // ... other methods protected: Derived* clone() const override { return new Derived(*this); } };

Derived derived; auto c1 = clone(derived);

Interface for cloneable classes.

Template Parameters

Member Typedef Documentation

template<typename T>
using Cloneable< T >::base_type = T

Constructor & Destructor Documentation

template<typename T>
virtual Cloneable< T >::~Cloneable ( )

Member Function Documentation

template<typename T>
virtual T* Cloneable< T >::clone ( ) const
protectedpure virtual

Polymorphic clone constructor. Method guarantees deep-copy.

pointer to cloned object

Implemented in shared_model::crypto::Blob, shared_model::proto::Transaction, shared_model::proto::Block, and shared_model::plain::Signature.

Friends And Related Function Documentation

template<typename T>
template<typename X >
std::unique_ptr<X> clone ( const X &  )

The documentation for this class was generated from the following file: