
15 Jul
2005
15 Jul
'05
7:37 p.m.
I've been following this dual_state vs optional discussion for a while. It seems to me that one should really have a policy class that defines the default behaviour when the value is unassigned. This policy should define whether to - throw an exception - construct an object on the fly - return a default - return a null pointer - whether to return by value or by reference A second point, can't all this be achieved by adding policies to smart pointers? Also, I can't quite see the benefit of having a dual-state that returns a default value. I mean, why use boost::dual_state<std::string> data; when you can simply use std::string data; ? Calum