DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

Vblock(C++)


Vblock -- Similar to Block

Synopsis

   # include <Vblock.h>
   

template <class T> class Vblock{ public: // similar to Block(3C++) };

Description

A Vblock is just like a Block (see Block(C++)), except that (for technical reasons having to do with G2++) some of its member functions are virtual. If a G2++ record definition (see G2++.4C++) specifies an array, the corresponding declaration generated by g2++comp(CP) in the .h file will contain a Vblock (see the Example).

Example

When compiled by g2++comp(1C++), the following record definition

       usr.g
           usr
                   name    *
                   proj
                           *(100)  LONG

generates a .h file containing the following:

       usr.h
           ... 
           typedef struct USR{
                   String name;
                   Vblock<LONG>     proj;
                   USR();
           }USR;

A client program may manipulate the proj field just as though it were a Block, e.g.,

           #include "usr.h"
           main(){
               USR u;
               for(int i=0;i<100;i++){
                   u.proj.reserve(i);
                   u.proj[i] = i;
               }
           }

References

Block(C++), G2++(C++), g2++comp(CP), typed_io(C++)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005