
3 Sep
2009
3 Sep
'09
5:21 p.m.
I'm new to boost::optional<>. I quickly looked through the online docs to see what this class does, and this was my first impression: boost::optional< char > c; if ( c ) { // should not enter this block } c = 'a'; if ( c ) { // should enter this block }
From what I was able to make out in 10-minutes, the class has a built-in boolean for the 'initialized' state so that it can be used in 'if()' statements. Also, the object it represents is not allocated until it is assigned ( if I'm not mistaken. )
I'm curious, what other bag of tricks does it come with? Regards, -Sid Sacek