mirror of
				https://github.com/rad4day/Waybar.git
				synced 2025-11-03 17:22:43 +01:00 
			
		
		
		
	fix: compilation errors with cpp_std=c++20
There were two main issues with fmtlib and C++20 mode: - `fmt::format` defaults to compile-time argument checking and requires using `fmt::runtime(format_string)` to bypass that. - `std::format` implementation introduces conflicting declarations and we have to specify the namespace for all `format`/`format_to` calls.
This commit is contained in:
		@@ -66,9 +66,9 @@ struct formatter<pow_format> {
 | 
			
		||||
    std::string string;
 | 
			
		||||
    switch (spec) {
 | 
			
		||||
      case '>':
 | 
			
		||||
        return format_to(ctx.out(), "{:>{}}", fmt::format("{}", s), max_width);
 | 
			
		||||
        return fmt::format_to(ctx.out(), "{:>{}}", fmt::format("{}", s), max_width);
 | 
			
		||||
      case '<':
 | 
			
		||||
        return format_to(ctx.out(), "{:<{}}", fmt::format("{}", s), max_width);
 | 
			
		||||
        return fmt::format_to(ctx.out(), "{:<{}}", fmt::format("{}", s), max_width);
 | 
			
		||||
      case '=':
 | 
			
		||||
        format = "{coefficient:<{number_width}.1f}{padding}{prefix}{unit}";
 | 
			
		||||
        break;
 | 
			
		||||
@@ -77,8 +77,8 @@ struct formatter<pow_format> {
 | 
			
		||||
        format = "{coefficient:.1f}{prefix}{unit}";
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
    return format_to(
 | 
			
		||||
        ctx.out(), format, fmt::arg("coefficient", fraction),
 | 
			
		||||
    return fmt::format_to(
 | 
			
		||||
        ctx.out(), fmt::runtime(format), fmt::arg("coefficient", fraction),
 | 
			
		||||
        fmt::arg("number_width", number_width),
 | 
			
		||||
        fmt::arg("prefix", std::string() + units[pow] + ((s.binary_ && pow) ? "i" : "")),
 | 
			
		||||
        fmt::arg("unit", s.unit_),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user