Boost logo

Boost :

From: Rainer Deyke (rdeyke_at_[hidden])
Date: 2024-07-09 20:00:06


On 09.07.24 18:18, Richard Hodges via Boost wrote:
> just a thought :
>
> It would be nice if this worked:
>
> #include <string>
> #include <algorithm>
>
> struct secure_string
> : std::basic_string<volatile char>
> {
>
> ~secure_string()
> {
> std::fill(begin(), end(), '\0');
> }
> };

That wouldn't be secure even if it did work. Consider what happens when
std::string is forced to reallocate.

-- 
Rainer Deyke (rainerd_at_[hidden])

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk