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
f5675698
Commit
f5675698
authored
Oct 13, 2021
by
Josh Essman
Committed by
Victor Zverovich
Oct 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: check to make sure both 'if constexpr' and return type deduction are available
fix: remaining ifdefs
parent
dcd282bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
include/fmt/compile.h
include/fmt/compile.h
+4
-4
test/compile-test.cc
test/compile-test.cc
+1
-1
No files found.
include/fmt/compile.h
View file @
f5675698
...
@@ -156,7 +156,7 @@ struct is_compiled_string : std::is_base_of<compiled_string, S> {};
...
@@ -156,7 +156,7 @@ struct is_compiled_string : std::is_base_of<compiled_string, S> {};
std::string s = fmt::format(FMT_COMPILE("{}"), 42);
std::string s = fmt::format(FMT_COMPILE("{}"), 42);
\endrst
\endrst
*/
*/
#if
def __cpp_if_constexpr
#if
defined(__cpp_if_constexpr) && defined(__cpp_return_type_deduction)
# define FMT_COMPILE(s) \
# define FMT_COMPILE(s) \
FMT_STRING_IMPL(s, fmt::detail::compiled_string, explicit)
FMT_STRING_IMPL(s, fmt::detail::compiled_string, explicit)
#else
#else
...
@@ -179,7 +179,7 @@ const T& first(const T& value, const Tail&...) {
...
@@ -179,7 +179,7 @@ const T& first(const T& value, const Tail&...) {
return
value
;
return
value
;
}
}
#if
def __cpp_if_constexpr
#if
defined(__cpp_if_constexpr) && defined(__cpp_return_type_deduction)
template
<
typename
...
Args
>
struct
type_list
{};
template
<
typename
...
Args
>
struct
type_list
{};
// Returns a reference to the argument at index N from [first, rest...].
// Returns a reference to the argument at index N from [first, rest...].
...
@@ -530,12 +530,12 @@ constexpr auto compile(S format_str) {
...
@@ -530,12 +530,12 @@ constexpr auto compile(S format_str) {
return
result
;
return
result
;
}
}
}
}
#endif //
__cpp_if_constexpr
#endif //
defined(__cpp_if_constexpr) && defined(__cpp_return_type_deduction)
}
// namespace detail
}
// namespace detail
FMT_MODULE_EXPORT_BEGIN
FMT_MODULE_EXPORT_BEGIN
#if
def __cpp_if_constexpr
#if
defined(__cpp_if_constexpr) && defined(__cpp_return_type_deduction)
template
<
typename
CompiledFormat
,
typename
...
Args
,
template
<
typename
CompiledFormat
,
typename
...
Args
,
typename
Char
=
typename
CompiledFormat
::
char_type
,
typename
Char
=
typename
CompiledFormat
::
char_type
,
...
...
test/compile-test.cc
View file @
f5675698
...
@@ -76,7 +76,7 @@ TEST(compile_test, compile_type_with_get) {
...
@@ -76,7 +76,7 @@ TEST(compile_test, compile_type_with_get) {
EXPECT_EQ
(
"42"
,
fmt
::
format
(
FMT_COMPILE
(
"{}"
),
type_with_get
()));
EXPECT_EQ
(
"42"
,
fmt
::
format
(
FMT_COMPILE
(
"{}"
),
type_with_get
()));
}
}
#if
def __cpp_if_constexpr
#if
defined(__cpp_if_constexpr) && defined(__cpp_return_type_deduction)
struct
test_formattable
{};
struct
test_formattable
{};
FMT_BEGIN_NAMESPACE
FMT_BEGIN_NAMESPACE
...
...
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