Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
cb302305
Unverified
Commit
cb302305
authored
Dec 23, 2021
by
Henry Schreiner
Committed by
GitHub
Dec 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: restore full range of _ functions (#3571)
parent
d4b9f347
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
8 deletions
+25
-8
include/pybind11/detail/descr.h
+25
-8
No files found.
include/pybind11/detail/descr.h
View file @
cb302305
...
@@ -57,14 +57,6 @@ template <size_t N>
...
@@ -57,14 +57,6 @@ template <size_t N>
constexpr
descr
<
N
-
1
>
const_name
(
char
const
(
&
text
)[
N
])
{
return
descr
<
N
-
1
>
(
text
);
}
constexpr
descr
<
N
-
1
>
const_name
(
char
const
(
&
text
)[
N
])
{
return
descr
<
N
-
1
>
(
text
);
}
constexpr
descr
<
0
>
const_name
(
char
const
(
&
)[
1
])
{
return
{};
}
constexpr
descr
<
0
>
const_name
(
char
const
(
&
)[
1
])
{
return
{};
}
// The "_" might be defined as a macro - don't define it if so.
// Repeating the const_name code to avoid introducing a #define.
#ifndef _
template
<
size_t
N
>
constexpr
descr
<
N
-
1
>
_
(
char
const
(
&
text
)[
N
])
{
return
descr
<
N
-
1
>
(
text
);
}
constexpr
descr
<
0
>
_
(
char
const
(
&
)[
1
])
{
return
{};
}
#endif
template
<
size_t
Rem
,
size_t
...
Digits
>
struct
int_to_str
:
int_to_str
<
Rem
/
10
,
Rem
%
10
,
Digits
...
>
{
};
template
<
size_t
Rem
,
size_t
...
Digits
>
struct
int_to_str
:
int_to_str
<
Rem
/
10
,
Rem
%
10
,
Digits
...
>
{
};
template
<
size_t
...
Digits
>
struct
int_to_str
<
0
,
Digits
...
>
{
template
<
size_t
...
Digits
>
struct
int_to_str
<
0
,
Digits
...
>
{
static
constexpr
auto
digits
=
descr
<
sizeof
...(
Digits
)
>
((
'0'
+
Digits
)...);
static
constexpr
auto
digits
=
descr
<
sizeof
...(
Digits
)
>
((
'0'
+
Digits
)...);
...
@@ -92,6 +84,31 @@ auto constexpr const_name() -> remove_cv_t<decltype(int_to_str<Size / 10, Size %
...
@@ -92,6 +84,31 @@ auto constexpr const_name() -> remove_cv_t<decltype(int_to_str<Size / 10, Size %
template
<
typename
Type
>
constexpr
descr
<
1
,
Type
>
const_name
()
{
return
{
'%'
};
}
template
<
typename
Type
>
constexpr
descr
<
1
,
Type
>
const_name
()
{
return
{
'%'
};
}
// The "_" might be defined as a macro - don't define it if so.
// Repeating the const_name code to avoid introducing a #define.
#ifndef _
template
<
size_t
N
>
constexpr
descr
<
N
-
1
>
_
(
char
const
(
&
text
)[
N
])
{
return
const_name
<
N
>
(
text
);
}
template
<
bool
B
,
size_t
N1
,
size_t
N2
>
constexpr
enable_if_t
<
B
,
descr
<
N1
-
1
>>
_
(
char
const
(
&
text1
)[
N1
],
char
const
(
&
text2
)[
N2
])
{
return
const_name
<
B
,
N1
,
N2
>
(
text1
,
text2
);
}
template
<
bool
B
,
size_t
N1
,
size_t
N2
>
constexpr
enable_if_t
<!
B
,
descr
<
N2
-
1
>>
_
(
char
const
(
&
text1
)[
N1
],
char
const
(
&
text2
)[
N2
])
{
return
const_name
<
B
,
N1
,
N2
>
(
text1
,
text2
);
}
template
<
bool
B
,
typename
T1
,
typename
T2
>
constexpr
enable_if_t
<
B
,
T1
>
_
(
const
T1
&
d1
,
const
T2
&
d2
)
{
return
const_name
<
B
,
T1
,
T2
>
(
d1
,
d2
);
}
template
<
bool
B
,
typename
T1
,
typename
T2
>
constexpr
enable_if_t
<!
B
,
T2
>
_
(
const
T1
&
d1
,
const
T2
&
d2
)
{
return
const_name
<
B
,
T1
,
T2
>
(
d1
,
d2
);
}
template
<
size_t
Size
>
auto
constexpr
_
()
->
remove_cv_t
<
decltype
(
int_to_str
<
Size
/
10
,
Size
%
10
>::
digits
)
>
{
return
const_name
<
Size
>
();
}
template
<
typename
Type
>
constexpr
descr
<
1
,
Type
>
_
()
{
return
const_name
<
Type
>
();
}
#endif
constexpr
descr
<
0
>
concat
()
{
return
{};
}
constexpr
descr
<
0
>
concat
()
{
return
{};
}
template
<
size_t
N
,
typename
...
Ts
>
template
<
size_t
N
,
typename
...
Ts
>
...
...
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