Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
b0c44446
Commit
b0c44446
authored
Sep 27, 2016
by
Wenzel Jakob
Browse files
format_descr constexpr tweak for MSVC by @jagerman (fixes #416)
parent
0a014e91
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
include/pybind11/common.h
include/pybind11/common.h
+3
-3
No files found.
include/pybind11/common.h
View file @
b0c44446
...
...
@@ -443,9 +443,9 @@ PYBIND11_RUNTIME_EXCEPTION(reference_cast_error, PyExc_RuntimeError) /// Used in
template
<
typename
T
,
typename
SFINAE
=
void
>
struct
format_descriptor
{
};
template
<
typename
T
>
struct
format_descriptor
<
T
,
detail
::
enable_if_t
<
std
::
is_integral
<
T
>::
value
>>
{
static
constexpr
const
char
value
[
2
]
=
{
"bBhHiIqQ"
[
detail
::
log2
(
sizeof
(
T
))
*
2
+
(
std
::
is_unsigned
<
T
>::
value
?
1
:
0
)]
,
'\0'
};
static
std
::
string
format
()
{
return
value
;
}
static
constexpr
const
char
c
=
"bBhHiIqQ"
[
detail
::
log2
(
sizeof
(
T
))
*
2
+
std
::
is_unsigned
<
T
>::
value
];
static
constexpr
const
char
value
[
2
]
=
{
c
,
'\0'
};
static
std
::
string
format
()
{
return
std
::
string
(
1
,
c
)
;
}
};
template
<
typename
T
>
constexpr
const
char
format_descriptor
<
...
...
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