improved example in tutorial

This commit is contained in:
Andrzej Krzemienski
2014-06-06 23:52:29 +02:00
parent a4e507077e
commit d25b0cfd59
3 changed files with 5 additions and 5 deletions

View File

@ -88,12 +88,12 @@ Suppose we want to implement a ['lazy load] optimization. This is because we do
class Widget
{
boost::optional<Resource> resource_;
mutable boost::optional<const Resource> resource_;
public:
Widget() {}
Resource& getResource() // not thread-safe
const Resource& getResource() const // not thread-safe
{
if (resource_ == boost::none)
resource_.emplace("resource", "arguments");