diff --git a/inc/hgl/Macro.h b/inc/hgl/Macro.h index 4fd5fa2..03cbf7b 100644 --- a/inc/hgl/Macro.h +++ b/inc/hgl/Macro.h @@ -77,4 +77,6 @@ namespace hgl name=nullptr; \ } \ } -}//namespace hgl \ No newline at end of file + + #define SAFE_CLEAR_STD_MAP(name) {for(auto &it:name)delete it.second;} +}//namespace hgl diff --git a/inc/hgl/type/StringInstance.h b/inc/hgl/type/StringInstance.h index 4db7d29..d1db086 100644 --- a/inc/hgl/type/StringInstance.h +++ b/inc/hgl/type/StringInstance.h @@ -400,7 +400,7 @@ namespace hgl if(need_length>malloc_length) { - malloc_length=power_to_2(need_length); + malloc_length=power_to_2(need_length+1); T *new_str=new T[malloc_length];