Import Geant4 10.7.0 source tree

This commit is contained in:
Gabriele Cosmo
2020-12-04 12:30:43 +01:00
parent 67ba86d073
commit dab42d2018
3770 changed files with 226369 additions and 286486 deletions
@@ -7,8 +7,8 @@ namespace tools {
template <class T>
inline bool realloc(T*& a_pointer,size_t a_new_size,size_t a_old_size,bool a_init = false) {
if(!a_new_size) {
delete [] a_pointer;
if(!a_new_size) {
delete [] a_pointer;
a_pointer = 0;
return true;
}
@@ -20,14 +20,14 @@ inline bool realloc(T*& a_pointer,size_t a_new_size,size_t a_old_size,bool a_ini
if(a_old_size==a_new_size) return true;
T* pointer = new T[a_new_size];
if(!pointer) {
delete [] a_pointer;
delete [] a_pointer;
a_pointer = 0;
return false;
}
if(a_new_size>a_old_size) {
::memcpy(pointer,a_pointer,a_old_size*sizeof(T));
if(a_init){
size_t num = a_new_size-a_old_size;
size_t num = a_new_size-a_old_size;
T* pos = pointer+a_old_size;
for(size_t i=0;i<num;i++,pos++) *pos = T();
}