$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: [boost] [optional] memory use for optional refs and ptrs
From: Rutger ter Borg (rutger_at_[hidden])
Date: 2010-10-05 08:09:13
Hello,
I'm looking into boost::optional<> as a replacement for some of my code
which has to deal with optional values. However, it seems that cases
which are usually space-efficient optionals (e.g., ptrs in the form of a
null-ptr) do not have template specializations. In other words, boost
optional templates store a bool and the memory footprint of its template
parameter, regardless of type. I.e., optional references and pointers
take their space plus the space of an extra bool.
Is there a reason for this?
Thanks,
Rutger