
2 Oct
2009
2 Oct
'09
2:33 p.m.
Domagoj Saric a écrit :
ps. it would be 'cool' if all of the functionality from boost::optional<> not related to the 'is initialized' bool (conditional destruction, etc...) could be extracted into a separate class (usefull for cases where you have to delay/in-place construct an object but are certain that you will construct it by the point where it needs to be used or destroyed...so you do not need the 'conditional' overhead)...
If you are sure that the optional gets initialized, then there is no point in such a thing to begin with. Simply don't declare your object before you can initialize it. If you can't, that probably means you need to reorganize your code.