#include <evo/impl/str.h>
template<class T>
struct evo::FmtFloatT< T >
Explicitly format a floating pointer number.
- Example
Example using FmtFloat
int main() {
str <<
FmtFloat(1.23, 3, 6) <<
',' << 4.56;
return 0;
}
|
| FmtFloatT (T num, int precision=fpCURRENT, int width=-1, char ch='0', char ch_sp=' ') |
| Constructor for POD number type with all attributes. More...
|
|
| FmtFloatT (const FloatClass &num, int precision=fpCURRENT, int width=-1, char ch='0', char ch_sp=' ') |
| Constructor for class number type (Float, etc) with all attributes. More...
|
|
This & | width (int width, char ch=0, char ch_sp=0) |
| Helper for setting padding attributes. More...
|
|
◆ FloatClass
◆ FloatPod
◆ FmtFieldType
This type paired with field info.
◆ This
◆ FmtFloatT() [1/2]
FmtFloatT |
( |
T |
num, |
|
|
int |
precision = fpCURRENT , |
|
|
int |
width = -1 , |
|
|
char |
ch = '0' , |
|
|
char |
ch_sp = ' ' |
|
) |
| |
|
inline |
Constructor for POD number type with all attributes.
- Parameters
-
num | Number to format |
precision | Precision to use (number of digits after decimal), fPREC_AUTO for automatic (default: fPREC_AUTO) |
width | Width to pad to, -1 for unspecified (default: 0) |
ch | Padding character to use, 0 for unspecified (default: '0') |
ch_sp | Padding character to use with special value (inf or nan), 0 for unspecified (default: ' ') |
◆ FmtFloatT() [2/2]
Constructor for class number type (Float, etc) with all attributes.
- Parameters
-
num | Number to format |
precision | Precision to use (number of digits after decimal), fPREC_AUTO for automatic (default: fPREC_AUTO) |
width | Width to pad to, -1 for unspecified (default: 0) |
ch | Padding character to use, 0 for unspecified (default: '0') |
ch_sp | Padding character to use with special value (inf or nan), 0 for unspecified (default: ' ') |
◆ width()
This& width |
( |
int |
width, |
|
|
char |
ch = 0 , |
|
|
char |
ch_sp = 0 |
|
) |
| |
|
inline |
Helper for setting padding attributes.
- Parameters
-
width | Width to pad to, -1 for unspecified (default: 0) |
ch | Padding character to use, 0 for unspecified (default: '0') |
ch_sp | Padding character to use with special value (inf or nan), 0 for unspecified (default: ' ') |
- Returns
- This
◆ fmt
◆ null
◆ num
The documentation for this struct was generated from the following file: