
On 7 September 2011 23:15, Mostafa <mostafa_working_away@yahoo.com> wrote:
1) Were the assignment operator disallowed for optional<T&> and only optional<T&>, there would no loss of programmatic generality when optional<T&> is used as a local variable.
I just don't see a use case for when it is a local variable, as it would have the same functionality as a const pointer (with slightly different syntax). And it would be rare indeed for me to even use const in this case, as protecting oneself against localized coding dicdecisions is futile, since all it takes is one edit to change it with no repercussions outside of the function itself. The case we've mentioned that you haven't covered is returning it from a function, which again, is problematic for two reasons: (1) Types that are Copyable but not Assignable are surprising (2) It is rare to return a reference anyway, as something outside of the callee has to manage the lifetime of the underlying object -- Nevin ":-)" Liber <mailto:nevin@eviloverlord.com> (847) 691-1404