Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
3940de59
Commit
3940de59
authored
Sep 05, 2021
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
thousands -> group_digits
parent
c4d0f96a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
include/fmt/format.h
include/fmt/format.h
+5
-5
test/format-test.cc
test/format-test.cc
+3
-3
No files found.
include/fmt/format.h
View file @
3940de59
...
...
@@ -2611,14 +2611,14 @@ template <> struct formatter<bytes> {
}
};
//
thousand
s_view is not derived from view because it copies the argument.
template
<
typename
T
>
struct
thousand
s_view
{
T
value
;
};
//
group_digit
s_view is not derived from view because it copies the argument.
template
<
typename
T
>
struct
group_digit
s_view
{
T
value
;
};
template
<
typename
T
>
auto
thousands
(
T
value
)
->
thousand
s_view
<
T
>
{
template
<
typename
T
>
auto
group_digits
(
T
value
)
->
group_digit
s_view
<
T
>
{
return
{
value
};
}
template
<
typename
T
>
struct
formatter
<
thousand
s_view
<
T
>>
:
formatter
<
T
>
{
template
<
typename
T
>
struct
formatter
<
group_digit
s_view
<
T
>>
:
formatter
<
T
>
{
private:
detail
::
dynamic_format_specs
<
char
>
specs_
;
...
...
@@ -2634,7 +2634,7 @@ template <typename T> struct formatter<thousands_view<T>> : formatter<T> {
}
template
<
typename
FormatContext
>
auto
format
(
thousand
s_view
<
T
>
t
,
FormatContext
&
ctx
)
->
decltype
(
ctx
.
out
())
{
auto
format
(
group_digit
s_view
<
T
>
t
,
FormatContext
&
ctx
)
->
decltype
(
ctx
.
out
())
{
detail
::
handle_dynamic_spec
<
detail
::
width_checker
>
(
specs_
.
width
,
specs_
.
width_ref
,
ctx
);
detail
::
handle_dynamic_spec
<
detail
::
precision_checker
>
(
...
...
test/format-test.cc
View file @
3940de59
...
...
@@ -1595,9 +1595,9 @@ TEST(format_test, bytes) {
EXPECT_EQ
(
10
,
s
.
size
());
}
TEST
(
format_test
,
thousands
)
{
EXPECT_EQ
(
fmt
::
format
(
"{}"
,
fmt
::
thousand
s
(
10000000
)),
"10,000,000"
);
EXPECT_EQ
(
fmt
::
format
(
"{:8}"
,
fmt
::
thousand
s
(
1000
)),
" 1,000"
);
TEST
(
format_test
,
group_digits_view
)
{
EXPECT_EQ
(
fmt
::
format
(
"{}"
,
fmt
::
group_digit
s
(
10000000
)),
"10,000,000"
);
EXPECT_EQ
(
fmt
::
format
(
"{:8}"
,
fmt
::
group_digit
s
(
1000
)),
" 1,000"
);
}
enum
test_enum
{
foo
,
bar
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment