Typically used classes variations defined with sanitizing_allocator

This commit is contained in:
Simon Rozman 2016-05-17 11:25:55 +02:00
parent a1a7ca6dac
commit 2cb830b341

View File

@ -27,6 +27,7 @@
#include <memory>
#include <string>
#include <vector>
///
@ -914,5 +915,45 @@ namespace winstd
#pragma warning(pop)
///
/// A sanitizing variant of std::vector
///
/// \note
/// `sanitizing_vector` introduces a performance penalty. However, it provides an additional level of security.
/// Use for security sensitive data memory storage only.
///
template<class _Ty>
class sanitizing_vector : public std::vector<_Ty, sanitizing_allocator<_Ty> >
{
};
///
/// A sanitizing variant of std::string
///
/// \note
/// `sanitizing_string` introduces a performance penalty. However, it provides an additional level of security.
/// Use for security sensitive data memory storage only.
///
typedef std::basic_string<char, std::char_traits<char>, sanitizing_allocator<char> > sanitizing_string;
///
/// A sanitizing variant of std::wstring
///
/// \note
/// `sanitizing_wstring` introduces a performance penalty. However, it provides an additional level of security.
/// Use for security sensitive data memory storage only.
///
typedef std::basic_string<wchar_t, std::char_traits<wchar_t>, sanitizing_allocator<wchar_t> > sanitizing_wstring;
#ifdef _UNICODE
typedef sanitizing_wstring sanitizing_tstring;
#else
typedef sanitizing_string sanitizing_tstring;
#endif
/// @}
}