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
023c2018
Commit
023c2018
authored
Oct 02, 2021
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't use strlen in constexpr
parent
800d4c8a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
include/fmt/core.h
include/fmt/core.h
+5
-3
No files found.
include/fmt/core.h
View file @
023c2018
...
...
@@ -314,11 +314,13 @@ FMT_BEGIN_DETAIL_NAMESPACE
// (void)var does not work on many Intel compilers.
template
<
typename
...
T
>
FMT_CONSTEXPR
void
ignore_unused
(
const
T
&
...)
{}
constexpr
FMT_INLINE
auto
is_constant_evaluated
()
FMT_NOEXCEPT
->
bool
{
constexpr
FMT_INLINE
auto
is_constant_evaluated
(
bool
default_value
=
false
)
FMT_NOEXCEPT
->
bool
{
#ifdef __cpp_lib_is_constant_evaluated
ignore_unused
(
default_value
);
return
std
::
is_constant_evaluated
();
#else
return
fals
e
;
return
default_valu
e
;
#endif
}
...
...
@@ -426,7 +428,7 @@ template <typename Char> class basic_string_view {
FMT_INLINE
basic_string_view
(
const
Char
*
s
)
:
data_
(
s
)
{
if
(
detail
::
const_check
(
std
::
is_same
<
Char
,
char
>::
value
&&
!
detail
::
is_constant_evaluated
()))
!
detail
::
is_constant_evaluated
(
true
)))
size_
=
std
::
strlen
(
reinterpret_cast
<
const
char
*>
(
s
));
else
size_
=
std
::
char_traits
<
Char
>::
length
(
s
);
...
...
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