Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abseil-cpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
abseil-cpp
Commits
1524b1ac
Commit
1524b1ac
authored
Jun 08, 2023
by
pateldeev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use InlinedVector
parent
afc9206b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
17 deletions
+4
-17
absl/strings/BUILD.bazel
+1
-0
absl/strings/internal/str_format/bind.h
+3
-17
No files found.
absl/strings/BUILD.bazel
View file @
1524b1ac
...
...
@@ -1169,6 +1169,7 @@ cc_library(
":strings",
"//absl/base:config",
"//absl/base:core_headers",
"//absl/container:inlined_vector",
"//absl/functional:function_ref",
"//absl/meta:type_traits",
"//absl/numeric:bits",
...
...
absl/strings/internal/str_format/bind.h
View file @
1524b1ac
...
...
@@ -21,6 +21,7 @@
#include <string>
#include "absl/base/port.h"
#include "absl/container/inlined_vector.h"
#include "absl/strings/internal/str_format/arg.h"
#include "absl/strings/internal/str_format/checker.h"
#include "absl/strings/internal/str_format/parser.h"
...
...
@@ -177,17 +178,7 @@ class Streamable {
public
:
Streamable
(
const
UntypedFormatSpecImpl
&
format
,
absl
::
Span
<
const
FormatArgImpl
>
args
)
:
format_
(
format
)
{
if
(
args
.
size
()
<=
ABSL_ARRAYSIZE
(
few_args_
))
{
for
(
size_t
i
=
0
;
i
<
args
.
size
();
++
i
)
{
few_args_
[
i
]
=
args
[
i
];
}
args_
=
absl
::
MakeSpan
(
few_args_
,
args
.
size
());
}
else
{
many_args_
.
assign
(
args
.
begin
(),
args
.
end
());
args_
=
many_args_
;
}
}
:
format_
(
format
),
args_
(
args
.
begin
(),
args
.
end
())
{
}
std
::
ostream
&
Print
(
std
::
ostream
&
os
)
const
;
...
...
@@ -197,12 +188,7 @@ class Streamable {
private
:
const
UntypedFormatSpecImpl
&
format_
;
absl
::
Span
<
const
FormatArgImpl
>
args_
;
// if args_.size() is 4 or less:
FormatArgImpl
few_args_
[
4
]
=
{
FormatArgImpl
(
0
),
FormatArgImpl
(
0
),
FormatArgImpl
(
0
),
FormatArgImpl
(
0
)};
// if args_.size() is more than 4:
std
::
vector
<
FormatArgImpl
>
many_args_
;
absl
::
InlinedVector
<
FormatArgImpl
,
4
>
args_
;
};
// for testing
...
...
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