1 #ifndef ARRAY_RESIZE_HPP_
2 #define ARRAY_RESIZE_HPP_
3 
4 template<class T> struct  Resize{ T *v;
ResizeResize5 	Resize( T * vv) : v(vv) {}
6 };
7 
resize1(const Resize<T> & t,const long & n)8 template<class T> T *resize1(const Resize<T> & t,const long &n)
9 {
10 	t.v->resize(n);
11 	return  t.v;
12 }
13 
resizeandclean1(const Resize<T> & t,const long & n)14 template<class T> T *resizeandclean1(const Resize<T> & t,const long &n)
15 {
16 
17 	int nn= t.v->N(); // old size
18 
19 	for (int i=n;i<nn;i++)  {delete (*t.v)[i];} // clean
20 	t.v->resize(n);
21 	for (int i=nn;i<n;i++)  {(*t.v)[i]=0;}
22 	return  t.v;
23 }
24 
25 
resize2(const Resize<T> & t,const long & n,const long & m)26 template<class T> T *resize2(const Resize<T> & t,const long &n, const long & m)
27 {
28 	t.v->resize(n,m);
29 	return  t.v;
30 }
31 
to_Resize(T * v)32 template<class T> Resize<T> to_Resize( T *v){ return Resize<T>(v);}
33 
34 template<class T> struct  Resize1{ T v;
Resize1Resize135 	Resize1( T  vv) : v(vv) {}
36 };
to_Resize1(T v)37 template<class T> Resize1<T> to_Resize1( T v){ return Resize1<T>(v);}
38 
39 template<class A,class B>  A Build(B b) {  return A(b);}
40 
41 #endif // ARRAY_RESIZE_HPP_
42