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
f5f3ffac
Commit
f5f3ffac
authored
Jun 06, 2019
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge string make_value overloads
parent
a38b99a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
28 deletions
+19
-28
include/fmt/core.h
include/fmt/core.h
+19
-28
No files found.
include/fmt/core.h
View file @
f5f3ffac
...
...
@@ -795,17 +795,27 @@ FMT_MAKE_VALUE(cstring_type, typename C::char_type*,
const
typename
C
::
char_type
*
)
FMT_MAKE_VALUE
(
cstring_type
,
const
typename
C
::
char_type
*
,
const
typename
C
::
char_type
*
)
FMT_MAKE_VALUE
(
cstring_type
,
signed
char
*
,
const
signed
char
*
)
FMT_MAKE_VALUE_SAME
(
cstring_type
,
const
signed
char
*
)
FMT_MAKE_VALUE
(
cstring_type
,
unsigned
char
*
,
const
unsigned
char
*
)
FMT_MAKE_VALUE_SAME
(
cstring_type
,
const
unsigned
char
*
)
FMT_MAKE_VALUE_SAME
(
string_type
,
basic_string_view
<
typename
C
::
char_type
>
)
FMT_MAKE_VALUE
(
string_type
,
typename
basic_string_view
<
typename
C
::
char_type
>::
type
,
basic_string_view
<
typename
C
::
char_type
>
)
FMT_MAKE_VALUE
(
string_type
,
const
std
::
basic_string
<
typename
C
::
char_type
>&
,
basic_string_view
<
typename
C
::
char_type
>
)
template
<
typename
C
,
typename
S
,
FMT_ENABLE_IF
(
internal
::
is_string
<
S
>
::
value
)
>
FMT_CONSTEXPR11
init
<
C
,
basic_string_view
<
typename
C
::
char_type
>
,
string_type
>
make_value
(
const
S
&
val
)
{
static_assert
(
std
::
is_same
<
typename
C
::
char_type
,
char_t
<
S
>>::
value
,
"mismatch between char-types of context and argument"
);
return
to_string_view
(
val
);
}
template
<
typename
C
,
typename
T
,
typename
Char
=
typename
C
::
char_type
,
FMT_ENABLE_IF
(
std
::
is_constructible
<
basic_string_view
<
Char
>,
T
>::
value
&&
!
internal
::
is_string
<
T
>::
value
)
>
inline
init
<
C
,
basic_string_view
<
Char
>
,
string_type
>
make_value
(
const
T
&
val
)
{
return
basic_string_view
<
Char
>
(
val
);
}
FMT_MAKE_VALUE
(
pointer_type
,
void
*
,
const
void
*
)
FMT_MAKE_VALUE_SAME
(
pointer_type
,
const
void
*
)
FMT_MAKE_VALUE
(
pointer_type
,
std
::
nullptr_t
,
const
void
*
)
...
...
@@ -827,14 +837,6 @@ inline init<C, int, int_type> make_value(const T& val) {
return
static_cast
<
int
>
(
val
);
}
template
<
typename
C
,
typename
T
,
typename
Char
=
typename
C
::
char_type
,
FMT_ENABLE_IF
(
std
::
is_constructible
<
basic_string_view
<
Char
>,
T
>::
value
&&
!
internal
::
is_string
<
T
>::
value
)
>
inline
init
<
C
,
basic_string_view
<
Char
>
,
string_type
>
make_value
(
const
T
&
val
)
{
return
basic_string_view
<
Char
>
(
val
);
}
// Implicit conversion to std::string is disallowed because it would be unsafe:
// https://github.com/fmtlib/fmt/issues/729
template
<
...
...
@@ -857,15 +859,6 @@ init<C, const void*, named_arg_type> make_value(
return
static_cast
<
const
void
*>
(
&
val
);
}
template
<
typename
C
,
typename
S
,
FMT_ENABLE_IF
(
internal
::
is_string
<
S
>
::
value
)
>
FMT_CONSTEXPR11
init
<
C
,
basic_string_view
<
typename
C
::
char_type
>
,
string_type
>
make_value
(
const
S
&
val
)
{
// Handle adapted strings.
static_assert
(
std
::
is_same
<
typename
C
::
char_type
,
char_t
<
S
>>::
value
,
"mismatch between char-types of context and argument"
);
return
to_string_view
(
val
);
}
// Maximum number of arguments with packed types.
enum
{
max_packed_args
=
15
};
enum
:
unsigned
long
long
{
is_unpacked_bit
=
1ull
<<
63
};
...
...
@@ -1313,11 +1306,9 @@ template <typename T, typename Char> struct named_arg : named_arg_base<Char> {
:
named_arg_base
<
Char
>
(
name
),
value
(
val
)
{}
};
template
<
typename
...
Args
,
typename
S
,
FMT_ENABLE_IF
(
!
is_compile_string
<
S
>
::
value
)
>
template
<
typename
...
,
typename
S
,
FMT_ENABLE_IF
(
!
is_compile_string
<
S
>
::
value
)
>
inline
void
check_format_string
(
const
S
&
)
{}
template
<
typename
...
Args
,
typename
S
,
FMT_ENABLE_IF
(
is_compile_string
<
S
>
::
value
)
>
template
<
typename
...
,
typename
S
,
FMT_ENABLE_IF
(
is_compile_string
<
S
>
::
value
)
>
void
check_format_string
(
S
);
template
<
typename
S
,
typename
...
Args
,
typename
Char
=
char_t
<
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