|
Boost : |
Subject: [boost] [optional] Incorrect example
From: Ahmed Charles (ahmedcharles_at_[hidden])
Date: 2011-04-07 17:23:15
int x = 1 ;
int& rx = x ;
optional<int&> ora ;
optional<int&> orb(x) ;
ora = orb ; // now 'ora' is bound to 'x' through 'rx'
*ora = 2 ; // Changes value of 'x' through '
ora'assert(x==2);
Either the comment on the fifth line is wrong or the fourth line
should construct from rx rather than x.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk