Improve example AbslUnparseFlag().
1. Move default case outside switch. This is a good practice because it allows -Wswitch to warn about missing enum values. 2. Use absl::StrCat() instead of (nonexistent) SimpleItoa().
This commit is contained in:
		
							parent
							
								
									43ef2148c0
								
							
						
					
					
						commit
						23dc759538
					
				
					 1 changed files with 3 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -106,10 +106,10 @@
 | 
			
		|||
//  // Returns a textual flag value corresponding to the OutputMode `mode`.
 | 
			
		||||
//  std::string AbslUnparseFlag(OutputMode mode) {
 | 
			
		||||
//    switch (mode) {
 | 
			
		||||
//     case kPlainText: return "plaintext";
 | 
			
		||||
//     case kHtml: return "html";
 | 
			
		||||
//     default: return SimpleItoa(mode);
 | 
			
		||||
//      case kPlainText: return "plaintext";
 | 
			
		||||
//      case kHtml: return "html";
 | 
			
		||||
//    }
 | 
			
		||||
//    return absl::SimpleItoa(mode);
 | 
			
		||||
//  }
 | 
			
		||||
//
 | 
			
		||||
// Notice that neither `AbslParseFlag()` nor `AbslUnparseFlag()` are class
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue