Opened 14 years ago
Closed 13 years ago
#2763 closed Bugs (duplicate)
'variant' documentation: bug in times_two() example
Reported by: | Owned by: | ebf | |
---|---|---|---|
Milestone: | Boost 1.39.0 | Component: | variant |
Version: | Boost 1.38.0 | Severity: | Problem |
Keywords: | documentation | Cc: |
Description
This page:
http://www.boost.org/doc/libs/1_38_0/doc/html/variant/tutorial.html
defines the following code snippet:
void times_two( boost::variant< int, std::string > & operand ) {
if ( int* pi = boost::get<int>( &v ) )
*pi *= 2;
else if ( std::string* pstr = boost::get<std::string>( &v ) )
*pstr += *pstr;
}
in which (1) 'v' is not defined and (2) 'operand' is not used. I suspect that this is not intentional, but rather, a mistake. Specifically, it seems that every occurrence of 'v' should be replaced by 'operand'.
Note:
See TracTickets
for help on using tickets.
Duplicates #1548.