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
6c012578
Commit
6c012578
authored
Nov 05, 2016
by
Jonathan Müller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add extern templates for format_float
Fixes #413.
parent
49ccb2e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
7 deletions
+34
-7
fmt/format.h
fmt/format.h
+34
-7
No files found.
fmt/format.h
View file @
6c012578
...
...
@@ -255,6 +255,21 @@ typedef __int64 intmax_t;
(!defined(FMT_ICC_VERSION) || FMT_ICC_VERSION >= 1500)
#endif
#ifndef FMT_USE_EXTERN_TEMPLATES
// Clang doesn't have a feature check for extern templates so we check
// for variadic templates which were introduced in the same version.
// For GCC according to cppreference.com they were introduced in 3.3.
# define FMT_USE_EXTERN_TEMPLATES \
((__clang__ && FMT_USE_VARIADIC_TEMPLATES) || \
FMT_GCC_VERSION >= 303)
#endif
#ifdef FMT_HEADER_ONLY
// If header only do not use extern templates.
# undef FMT_USE_EXTERN_TEMPLATES
# define FMT_USE_EXTERN_TEMPLATES 0
#endif
#ifndef FMT_ASSERT
# define FMT_ASSERT(condition, message) assert((condition) && message)
#endif
...
...
@@ -812,6 +827,15 @@ class CharTraits<char> : public BasicCharTraits<char> {
const
char
*
format
,
unsigned
width
,
int
precision
,
T
value
);
};
#if FMT_USE_EXTERN_TEMPLATES
extern
template
int
CharTraits
<
char
>
::
format_float
<
double
>
(
char
*
buffer
,
std
::
size_t
size
,
const
char
*
format
,
unsigned
width
,
int
precision
,
double
value
);
extern
template
int
CharTraits
<
char
>
::
format_float
<
long
double
(
char
*
buffer
,
std
::
size_t
size
,
const
char
*
format
,
unsigned
width
,
int
precision
,
long
double
value
);
#endif
template
<
>
class
CharTraits
<
wchar_t
>
:
public
BasicCharTraits
<
wchar_t
>
{
public:
...
...
@@ -823,6 +847,15 @@ class CharTraits<wchar_t> : public BasicCharTraits<wchar_t> {
const
wchar_t
*
format
,
unsigned
width
,
int
precision
,
T
value
);
};
#if FMT_USE_EXTERN_TEMPLATES
extern
template
int
CharTraits
<
wchar_t
>
::
format_float
<
double
>
(
wchar_t
*
buffer
,
std
::
size_t
size
,
const
wchar_t
*
format
,
unsigned
width
,
int
precision
,
double
value
);
extern
template
int
CharTraits
<
wchar_t
>
::
format_float
<
long
double
>
(
wchar_t
*
buffer
,
std
::
size_t
size
,
const
wchar_t
*
format
,
unsigned
width
,
int
precision
,
long
double
value
);
#endif
// Checks if a number is negative - used to avoid warnings.
template
<
bool
IsSigned
>
struct
SignChecker
{
...
...
@@ -869,13 +902,7 @@ struct FMT_API BasicData {
static
const
char
DIGITS
[];
};
#ifndef FMT_USE_EXTERN_TEMPLATES
// Clang doesn't have a feature check for extern templates so we check
// for variadic templates which were introduced in the same version.
# define FMT_USE_EXTERN_TEMPLATES (__clang__ && FMT_USE_VARIADIC_TEMPLATES)
#endif
#if FMT_USE_EXTERN_TEMPLATES && !defined(FMT_HEADER_ONLY)
#if FMT_USE_EXTERN_TEMPLATES
extern
template
struct
BasicData
<
void
>;
#endif
...
...
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