Skip to content

Commit ea19c71

Browse files
author
Fytch
committed
rename i to opt in parser::operator<<; improves readability and stops a warning about shadowing a local variable
1 parent af40862 commit ea19c71

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

ProgramOptions.hxx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,9 +1987,9 @@ namespace po {
19871987
stream << "\nAvailable options:\n";
19881988
bool any_abbreviations = false;
19891989
std::size_t max_verbose = 0;
1990-
for( auto&& i : object.m_options ) {
1991-
any_abbreviations |= i.second.get_abbreviation() != '\0';
1992-
max_verbose = std::max( max_verbose, i.first.size() );
1990+
for( auto&& opt : object.m_options ) {
1991+
any_abbreviations |= opt.second.get_abbreviation() != '\0';
1992+
max_verbose = std::max( max_verbose, opt.first.size() );
19931993
}
19941994
const bool any_verbose = max_verbose > 1;
19951995
if( any_verbose )
@@ -1999,12 +1999,12 @@ namespace po {
19991999
const std::size_t verbose_start = left_padding + abbreviation_width + separator_width;
20002000
const std::size_t verbose_width = std::min( any_verbose * max_verbose_width, max_verbose );
20012001
const std::size_t description_start = verbose_start + verbose_width + mid_padding;
2002-
for( auto&& i : object.m_options ) {
2003-
if( i.first.empty() )
2002+
for( auto&& opt : object.m_options ) {
2003+
if( opt.first.empty() )
20042004
continue;
20052005
stream << repeat{ left_padding, ' ' };
2006-
const char abbreviation = i.second.get_abbreviation();
2007-
const bool verbose = i.first.size() > 1;
2006+
const char abbreviation = opt.second.get_abbreviation();
2007+
const bool verbose = opt.first.size() > 1;
20082008
if( abbreviation )
20092009
stream << white << '-' << abbreviation;
20102010
else
@@ -2014,8 +2014,8 @@ namespace po {
20142014
else
20152015
stream << repeat{ separator_width, ' ' };
20162016
if( verbose ) {
2017-
stream << white << '-' << '-' << i.first;
2018-
const int rem = static_cast< int >( verbose_width ) - 2 - static_cast< int >( i.first.size() );
2017+
stream << white << '-' << '-' << opt.first;
2018+
const int rem = static_cast< int >( verbose_width ) - 2 - static_cast< int >( opt.first.size() );
20192019
if( rem >= 0 )
20202020
stream << repeat{ static_cast< std::size_t >( rem ) + mid_padding, ' ' };
20212021
else
@@ -2024,7 +2024,7 @@ namespace po {
20242024
stream << repeat{ verbose_width + mid_padding, ' ' };
20252025
}
20262026
std::size_t carriage = description_start;
2027-
std::string const& descr = i.second.get_description();
2027+
std::string const& descr = opt.second.get_description();
20282028
for( std::size_t i = 0; i < descr.size(); ++i ) {
20292029
const bool last = ( i + 1 < descr.size() ) && ( carriage + 1 >= console_width );
20302030
if( last ) {

0 commit comments

Comments
 (0)