Displaying 3 results from an estimated 3 matches for "col_width".
2016 Oct 13
2
RFC: General purpose type-safe formatting library
...ime, there's no other way
>
>
> Maybe the problem is using a string to format this in the first place.
>
> For example, you could wrap the object you want to print with an adaptor
> in charge of padding to the right till you reach the column width.
>
> format(“{0}”, rPad(col_width, my_object));
>
>
> FWIW I do think that literal format strings will handle 90% or more of
> uses. I just don't see the benefit of needlessly banning the other cases.
> Because all that's going to happen is someone is going to resort to using
> snprintf etc, which is exac...
2016 Oct 13
2
RFC: General purpose type-safe formatting library
...ime, there's no other way
>
>
> Maybe the problem is using a string to format this in the first place.
>
> For example, you could wrap the object you want to print with an adaptor
> in charge of padding to the right till you reach the column width.
>
> format(“{0}”, rPad(col_width, my_object));
>
FWIW I do think that literal format strings will handle 90% or more of
uses. I just don't see the benefit of needlessly banning the other cases.
Because all that's going to happen is someone is going to resort to using
snprintf etc, which is exactly the problem I'm...
2016 Oct 12
5
RFC: General purpose type-safe formatting library
You get compile time checking automatically when we can use c++14 though.
If you use it with a string literal, you'll get compile time checking,
otherwise you won't.
Here's a different example though. Suppose you're writing a tool which
prints formatted output, and the field width is specified by the user. Now
you NEED to build the format string at runtime, there's no other