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
0787d697
Commit
0787d697
authored
Jun 05, 2019
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify SFINAE
parent
bae00aa8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
15 deletions
+12
-15
include/fmt/core.h
include/fmt/core.h
+12
-15
No files found.
include/fmt/core.h
View file @
0787d697
...
@@ -402,6 +402,12 @@ template <typename S>
...
@@ -402,6 +402,12 @@ template <typename S>
struct
is_string
:
std
::
is_class
<
decltype
(
to_string_view
(
std
::
declval
<
S
>
()))
>
{
struct
is_string
:
std
::
is_class
<
decltype
(
to_string_view
(
std
::
declval
<
S
>
()))
>
{
};
};
template
<
typename
S
,
typename
=
void
>
struct
char_t_impl
{};
template
<
typename
S
>
struct
char_t_impl
<
S
,
enable_if_t
<
is_string
<
S
>::
value
>>
{
using
result
=
decltype
(
to_string_view
(
std
::
declval
<
S
>
()));
using
type
=
typename
result
::
char_type
;
};
struct
error_handler
{
struct
error_handler
{
FMT_CONSTEXPR
error_handler
()
{}
FMT_CONSTEXPR
error_handler
()
{}
FMT_CONSTEXPR
error_handler
(
const
error_handler
&
)
{}
FMT_CONSTEXPR
error_handler
(
const
error_handler
&
)
{}
...
@@ -411,6 +417,9 @@ struct error_handler {
...
@@ -411,6 +417,9 @@ struct error_handler {
};
};
}
// namespace internal
}
// namespace internal
/** String's character type. */
template
<
typename
S
>
using
char_t
=
typename
internal
::
char_t_impl
<
S
>::
type
;
// Parsing context consisting of a format string range being parsed and an
// Parsing context consisting of a format string range being parsed and an
// argument counter for automatic indexing.
// argument counter for automatic indexing.
template
<
typename
Char
,
typename
ErrorHandler
=
internal
::
error_handler
>
template
<
typename
Char
,
typename
ErrorHandler
=
internal
::
error_handler
>
...
@@ -598,12 +607,6 @@ struct fallback_formatter {
...
@@ -598,12 +607,6 @@ struct fallback_formatter {
"an operator<< that should be used"
);
"an operator<< that should be used"
);
};
};
template
<
typename
S
,
typename
=
void
>
struct
char_t_impl
{};
template
<
typename
S
>
struct
char_t_impl
<
S
,
enable_if_t
<
is_string
<
S
>::
value
>>
{
typedef
decltype
(
to_string_view
(
std
::
declval
<
S
>
()))
result
;
typedef
typename
result
::
char_type
type
;
};
template
<
typename
Char
>
struct
named_arg_base
;
template
<
typename
Char
>
struct
named_arg_base
;
template
<
typename
T
,
typename
Char
>
struct
named_arg
;
template
<
typename
T
,
typename
Char
>
struct
named_arg
;
...
@@ -1281,9 +1284,6 @@ struct wformat_args : basic_format_args<wformat_context> {
...
@@ -1281,9 +1284,6 @@ struct wformat_args : basic_format_args<wformat_context> {
:
basic_format_args
<
wformat_context
>
(
std
::
forward
<
Args
>
(
arg
)...)
{}
:
basic_format_args
<
wformat_context
>
(
std
::
forward
<
Args
>
(
arg
)...)
{}
};
};
/** String's character type. */
template
<
typename
S
>
using
char_t
=
typename
internal
::
char_t_impl
<
S
>::
type
;
namespace
internal
{
namespace
internal
{
template
<
typename
Context
>
template
<
typename
Context
>
FMT_CONSTEXPR
typename
Context
::
format_arg
get_arg
(
Context
&
ctx
,
unsigned
id
)
{
FMT_CONSTEXPR
typename
Context
::
format_arg
get_arg
(
Context
&
ctx
,
unsigned
id
)
{
...
@@ -1321,8 +1321,7 @@ template <typename... Args, typename S,
...
@@ -1321,8 +1321,7 @@ template <typename... Args, typename S,
FMT_ENABLE_IF
(
is_compile_string
<
S
>
::
value
)
>
FMT_ENABLE_IF
(
is_compile_string
<
S
>
::
value
)
>
void
check_format_string
(
S
);
void
check_format_string
(
S
);
template
<
typename
S
,
typename
...
Args
,
template
<
typename
S
,
typename
...
Args
,
typename
Char
=
char_t
<
S
>
>
typename
Char
=
enable_if_t
<
internal
::
is_string
<
S
>
::
value
,
char_t
<
S
>>>
inline
format_arg_store
<
buffer_context
<
Char
>
,
Args
...
>
make_args_checked
(
inline
format_arg_store
<
buffer_context
<
Char
>
,
Args
...
>
make_args_checked
(
const
S
&
format_str
,
const
Args
&
...
args
)
{
const
S
&
format_str
,
const
Args
&
...
args
)
{
internal
::
check_format_string
<
Args
...
>
(
format_str
);
internal
::
check_format_string
<
Args
...
>
(
format_str
);
...
@@ -1403,8 +1402,7 @@ inline std::back_insert_iterator<Container> format_to(
...
@@ -1403,8 +1402,7 @@ inline std::back_insert_iterator<Container> format_to(
{
internal
::
make_args_checked
(
format_str
,
args
...)});
{
internal
::
make_args_checked
(
format_str
,
args
...)});
}
}
template
<
typename
S
,
template
<
typename
S
,
typename
Char
=
char_t
<
S
>
>
typename
Char
=
enable_if_t
<
internal
::
is_string
<
S
>
::
value
,
char_t
<
S
>>>
inline
std
::
basic_string
<
Char
>
vformat
(
inline
std
::
basic_string
<
Char
>
vformat
(
const
S
&
format_str
,
basic_format_args
<
buffer_context
<
Char
>>
args
)
{
const
S
&
format_str
,
basic_format_args
<
buffer_context
<
Char
>>
args
)
{
return
internal
::
vformat
(
to_string_view
(
format_str
),
args
);
return
internal
::
vformat
(
to_string_view
(
format_str
),
args
);
...
@@ -1422,8 +1420,7 @@ inline std::basic_string<Char> vformat(
...
@@ -1422,8 +1420,7 @@ inline std::basic_string<Char> vformat(
*/
*/
// Pass char_t as a default template parameter instead of using
// Pass char_t as a default template parameter instead of using
// std::basic_string<char_t<S>> to reduce the symbol size.
// std::basic_string<char_t<S>> to reduce the symbol size.
template
<
typename
S
,
typename
...
Args
,
template
<
typename
S
,
typename
...
Args
,
typename
Char
=
char_t
<
S
>
>
typename
Char
=
enable_if_t
<
internal
::
is_string
<
S
>
::
value
,
char_t
<
S
>>>
inline
std
::
basic_string
<
Char
>
format
(
const
S
&
format_str
,
inline
std
::
basic_string
<
Char
>
format
(
const
S
&
format_str
,
const
Args
&
...
args
)
{
const
Args
&
...
args
)
{
return
internal
::
vformat
(
to_string_view
(
format_str
),
return
internal
::
vformat
(
to_string_view
(
format_str
),
...
...
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