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
2dea780f
Commit
2dea780f
authored
Oct 26, 2018
by
XZiar
Committed by
Victor Zverovich
Oct 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change type naming and fix sfinae bug
parent
b98e8301
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
12 deletions
+12
-12
include/fmt/core.h
include/fmt/core.h
+4
-4
include/fmt/format.h
include/fmt/format.h
+6
-6
test/format-test.cc
test/format-test.cc
+2
-2
No files found.
include/fmt/core.h
View file @
2dea780f
...
...
@@ -472,10 +472,10 @@ struct compile_string {};
template
<
typename
S
>
struct
is_compile_string
:
std
::
is_base_of
<
compile_string
,
S
>
{};
template
<
typename
S
,
typename
Enable
=
std
::
enable_if
<
is_compile_string
<
S
>
::
value
>
>
inline
auto
to_string_view
(
const
S
&
s
)
->
basic_string_view
<
typename
S
::
Char
>
{
typedef
typename
S
::
Char
Char
;
return
basic_string_view
<
Char
>
{
s
.
data
(),
s
.
size
()
-
1
};
template
<
typename
S
,
typename
Enable
=
typename
std
::
enable_if
<
is_compile_string
<
S
>
::
value
>::
type
>
inline
auto
to_string_view
(
const
S
&
s
)
->
basic_string_view
<
typename
S
::
char_type
>
{
typedef
typename
S
::
char_type
char_type
;
return
basic_string_view
<
char_type
>
{
s
.
data
(),
s
.
size
()
-
1
};
}
template
<
typename
Context
>
...
...
include/fmt/format.h
View file @
2dea780f
...
...
@@ -2243,10 +2243,10 @@ FMT_CONSTEXPR bool check_format_string(
template
<
typename
...
Args
,
typename
String
>
typename
std
::
enable_if
<
is_compile_string
<
String
>::
value
>::
type
check_format_string
(
String
format_str
)
{
typedef
typename
String
::
Char
Char
;
typedef
typename
String
::
char_type
char_type
;
FMT_CONSTEXPR_DECL
bool
invalid_format
=
internal
::
check_format_string
<
Char
,
internal
::
error_handler
,
Args
...
>
(
basic_string_view
<
Char
>
(
format_str
.
data
(),
format_str
.
size
()));
internal
::
check_format_string
<
char_type
,
internal
::
error_handler
,
Args
...
>
(
basic_string_view
<
char_type
>
(
format_str
.
data
(),
format_str
.
size
()));
(
void
)
invalid_format
;
}
...
...
@@ -3598,10 +3598,10 @@ FMT_END_NAMESPACE
#define FMT_STRING(s) [] { \
typedef typename std::decay<decltype(s)>::type pointer; \
struct S : fmt::compile_string { \
typedef typename std::remove_cv<std::remove_pointer<pointer>::type>::type
Char
;\
typedef typename std::remove_cv<std::remove_pointer<pointer>::type>::type
char_type
;\
static FMT_CONSTEXPR pointer data() { return s; } \
static FMT_CONSTEXPR size_t size() { return sizeof(s) / sizeof(
Char
); } \
explicit operator fmt::basic_string_view<
Char
>() const { return s; } \
static FMT_CONSTEXPR size_t size() { return sizeof(s) / sizeof(
char_type
); } \
explicit operator fmt::basic_string_view<
char_type
>() const { return s; } \
}; \
return S{}; \
}()
...
...
test/format-test.cc
View file @
2dea780f
...
...
@@ -2380,8 +2380,8 @@ TEST(FormatTest, VFormatTo) {
fmt
::
vformat_to
(
std
::
back_inserter
(
w
),
L"{}"
,
wargs
);
EXPECT_EQ
(
L"42"
,
w
);
w
.
clear
();
fmt
::
vformat_to
(
std
::
back_inserter
(
w
),
FMT_STRING
(
L"{}"
),
args
);
EXPECT_EQ
(
"42"
,
w
);
fmt
::
vformat_to
(
std
::
back_inserter
(
w
),
FMT_STRING
(
L"{}"
),
w
args
);
EXPECT_EQ
(
L
"42"
,
w
);
}
#endif // FMT_USE_CONSTEXPR
...
...
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