c++ - std::size and resize: implementing in C -


i new c++ !!

can please give me hints, how size , resize works under namespace std in c++ ?

resize taking argument of int type , size not take argument.

what similar implementation in c ??

below code snap:

class nameclass {     private:         int var1;         unsigned int var2;         std::vector<unsigned int>location;         unsigned int var3;         int var4;     public:         void func1() {return retval; }         void func2() {return retval; } } 

trying access:

location.resize(val);    //int val location.size(); 

thank suggestion !!

in c might this

typedef struct c_int_vector {     int *elements;     int size;     int allocated; } c_int_vector;  int c_int_vector_size(const c_int_vector *vec) {     return vec->size; }  void c_int_vector_resize(c_int_vector *vec, int new_size) {     if (new_size > vec->allocated)     {         // reallocate vector elements here     }     vec->size = new_size; } 

i've skipped of details of course.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -