Utility method to calculate memory size to store a container data

pull/3/head
Hleb Valoshka 2019-07-07 12:02:06 +03:00
parent 845990a91a
commit 6712b90d84
1 changed files with 6 additions and 0 deletions

View File

@ -63,4 +63,10 @@ template <class T> struct deleteFunc : public std::unary_function<T, void>
int dummy;
};
// size in bytes of memory required to store a container data
template<typename T> constexpr typename T::size_type memsize(T c)
{
return c.size() * sizeof(typename T::value_type);
}
#endif // _CELUTIL_UTIL_H_