Main Page   Namespace List   Class Hierarchy   Compound List   File List   Header Files   Namespace Members   Compound Members   File Members  

arg_deep_copy_utils.h

This is the verbatim text of the arg_deep_copy_utils.h include file.

#ifndef ARG_DEEP_COPY_UTILS_H
#define ARG_DEEP_COPY_UTILS_H

#ifndef ARG_COMPILER_H
#include "arg_compiler.h"
#endif

namespace arg
{
    struct cloneable {};
    

    struct Cloneable {};

    template<class p_type>
    inline p_type* deep_copy(const p_type* p, const void*) 
    {
        return p ? new p_type(*p) : 0;
    }
    
    
    template<class p_type>
    inline p_type* deep_copy(const p_type *p, const cloneable *)
    {
        return p ? p->clone() : 0;
    }
    

    template<class p_type>
    inline p_type* deep_copy(const p_type *p, const Cloneable *)
    {
        return p ? p->makeClone() : 0;
    }
        

    template<class p_type>
    inline p_type* deep_copy(const p_type* p) 
    {
        return deep_copy(p, p);
    }
}

#endif

Copyright 1999-2000 Alan Griffiths