1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #include <iostream> #include <cstdlib> /* type definitions ----------------------------------------------------------*/ typedef struct { // has no data definitions }Seg; /* function declarations -----------------------------------------------------*/ Seg* seg_clone(); /* global variables ----------------------------------------------------------*/ typedef Seg *(*VR_SEG_FUNC)(); static const VR_SEG_FUNC seg_vtable[] = { /*seg_new,*/ /*seg_delete,*/ seg_clone/*, seg_init*/ }; /* main function ------------------------------------------------------------*/ int main () { using namespace std; cin.get(); } /* function definitions ------------------------------------------------------*/ Seg* seg_clone( Seg *src ) { Seg *dest = new Seg; memcpy( dest, src, sizeof(Seg) ); return dest; } ////////////////////////////////////////// Seg *source; Seg* seg_clone() { return seg_clone( source ); } |
Direct link: https://paste.plurk.com/show/277725