mirror of
				https://github.com/fmtlib/fmt.git
				synced 2025-11-04 08:01:40 +01:00 
			
		
		
		
	Minor changes to follow C++ Format's coding conventions
This commit is contained in:
		
							
								
								
									
										17
									
								
								biicode/samples/basic.cc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								biicode/samples/basic.cc
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
#include "vitaut/cppformat/format.h"
 | 
			
		||||
 | 
			
		||||
class Date {
 | 
			
		||||
  int year_, month_, day_;
 | 
			
		||||
 public:
 | 
			
		||||
  Date(int year, int month, int day) : year_(year), month_(month), day_(day) {}
 | 
			
		||||
 | 
			
		||||
  friend std::ostream &operator<<(std::ostream &os, const Date &d) {
 | 
			
		||||
    return os << d.year_ << '-' << d.month_ << '-' << d.day_;
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
int main(int argc, char *argv[]){
 | 
			
		||||
  std::string s = fmt::format("The date is {}", Date(2012, 12, 9));
 | 
			
		||||
  fmt::print("Hello, {}!", "world");  // uses Python-like format string syntax
 | 
			
		||||
  fmt::printf("\n%s", s); // uses printf format string syntax
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user