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
0a985fd4
Unverified
Commit
0a985fd4
authored
Oct 03, 2021
by
Vladislav Shchapov
Committed by
GitHub
Oct 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move size_ initialization to initializer list (#2529)
parent
012cc709
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
9 deletions
+7
-9
include/fmt/core.h
include/fmt/core.h
+6
-7
include/fmt/format.h
include/fmt/format.h
+1
-2
No files found.
include/fmt/core.h
View file @
0a985fd4
...
...
@@ -433,13 +433,12 @@ template <typename Char> class basic_string_view {
*/
FMT_CONSTEXPR_CHAR_TRAITS
FMT_INLINE
basic_string_view
(
const
Char
*
s
)
:
data_
(
s
)
{
if
(
detail
::
const_check
(
std
::
is_same
<
Char
,
char
>::
value
&&
!
detail
::
is_constant_evaluated
(
true
)))
size_
=
std
::
strlen
(
reinterpret_cast
<
const
char
*>
(
s
));
else
size_
=
std
::
char_traits
<
Char
>::
length
(
s
);
}
basic_string_view
(
const
Char
*
s
)
:
data_
(
s
),
size_
(
detail
::
const_check
(
std
::
is_same
<
Char
,
char
>::
value
&&
!
detail
::
is_constant_evaluated
(
true
))
?
std
::
strlen
(
reinterpret_cast
<
const
char
*>
(
s
))
:
std
::
char_traits
<
Char
>::
length
(
s
))
{}
/** Constructs a string reference from a ``std::basic_string`` object. */
template
<
typename
Traits
,
typename
Alloc
>
...
...
include/fmt/format.h
View file @
0a985fd4
...
...
@@ -2109,8 +2109,7 @@ FMT_CONSTEXPR_CHAR_TRAITS auto write(OutputIt out, const Char* value)
if
(
!
value
)
{
throw_format_error
(
"string pointer is null"
);
}
else
{
auto
length
=
std
::
char_traits
<
Char
>::
length
(
value
);
out
=
write
(
out
,
basic_string_view
<
Char
>
(
value
,
length
));
out
=
write
(
out
,
basic_string_view
<
Char
>
(
value
));
}
return
out
;
}
...
...
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