@@ -321,47 +321,47 @@ We may bind options to variables of type `std::string`, to 32- or 64-bit signed
321
321
#include < string_view>
322
322
323
323
int main ( int argc, char** argv ) {
324
- po::parser parser;
325
-
326
- std::uint32_t optimization = 0; // the value we set here acts as an implicit fallback
327
- parser[ "optimization" ]
328
- .abbreviation( 'O' )
329
- .description( "set the optimization level (default: -O0)" )
330
- .bind( optimization ); // write the parsed value to the variable 'optimization'
331
- // .bind( optimization ) automatically calls .type( po::u32 ) and .single()
332
-
333
- std::vector< std::string > include_paths;
334
- parser[ "include-path" ]
335
- .abbreviation( 'I' )
336
- .description( "add an include path" )
337
- .bind( include_paths ); // append paths to the vector 'include_paths'
338
-
339
- parser[ "help" ]
340
- .abbreviation( '?' )
341
- .description( "print this help screen" );
342
-
343
- std::deque< std::string > files;
344
- parser[ "" ]
345
- .bind( files ); // append paths to the deque 'include_paths
346
-
347
- if( !parser( argc, argv ) )
348
- return -1;
349
-
350
- // we don't want to print anything else if the help screen has been displayed
351
- if( parser[ "help" ].was_set() ) {
352
- std::cout << parser << '\n';
353
- return 0;
354
- }
355
-
356
- // print the parsed values
357
- // note that we don't need to access parser anymore; all data is stored in the bound variables
358
- std::cout << "optimization level = " << optimization << '\n';
359
- std::cout << "include files (" << files.size() << "):\n";
360
- for( auto&& i : files )
361
- std::cout << '\t' << i << '\n';
362
- std::cout << "include paths (" << include_paths.size() << "):\n";
363
- for( auto&& i : include_paths )
364
- std::cout << '\t' << i << '\n';
324
+ po::parser parser;
325
+
326
+ std::uint32_t optimization = 0; // the value we set here acts as an implicit fallback
327
+ parser[ "optimization" ]
328
+ .abbreviation( 'O' )
329
+ .description( "set the optimization level (default: -O0)" )
330
+ .bind( optimization ); // write the parsed value to the variable 'optimization'
331
+ // .bind( optimization ) automatically calls .type( po::u32 ) and .single()
332
+
333
+ std::vector< std::string > include_paths;
334
+ parser[ "include-path" ]
335
+ .abbreviation( 'I' )
336
+ .description( "add an include path" )
337
+ .bind( include_paths ); // append paths to the vector 'include_paths'
338
+
339
+ parser[ "help" ]
340
+ .abbreviation( '?' )
341
+ .description( "print this help screen" );
342
+
343
+ std::deque< std::string > files;
344
+ parser[ "" ]
345
+ .bind( files ); // append paths to the deque 'include_paths
346
+
347
+ if( !parser( argc, argv ) )
348
+ return -1;
349
+
350
+ // we don't want to print anything else if the help screen has been displayed
351
+ if( parser[ "help" ].was_set() ) {
352
+ std::cout << parser << '\n';
353
+ return 0;
354
+ }
355
+
356
+ // print the parsed values
357
+ // note that we don't need to access parser anymore; all data is stored in the bound variables
358
+ std::cout << "optimization level = " << optimization << '\n';
359
+ std::cout << "include files (" << files.size() << "):\n";
360
+ for( auto&& i : files )
361
+ std::cout << '\t' << i << '\n';
362
+ std::cout << "include paths (" << include_paths.size() << "):\n";
363
+ for( auto&& i : include_paths )
364
+ std::cout << '\t' << i << '\n';
365
365
}
366
366
```
367
367
0 commit comments