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
b342c373
Commit
b342c373
authored
Sep 10, 2020
by
Henry Schreiner
Committed by
Henry Schreiner
Sep 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style: clang-tidy: modernize-use-using
parent
96e6a8d5
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
22 deletions
+23
-22
.clang-tidy
+1
-0
include/pybind11/chrono.h
+3
-3
include/pybind11/detail/common.h
+9
-9
include/pybind11/numpy.h
+1
-1
include/pybind11/pybind11.h
+1
-1
tests/test_class.cpp
+8
-8
No files found.
.clang-tidy
View file @
b342c373
...
@@ -5,6 +5,7 @@ Checks: '
...
@@ -5,6 +5,7 @@ Checks: '
llvm-namespace-comment,
llvm-namespace-comment,
modernize-use-override,
modernize-use-override,
readability-container-size-empty,
readability-container-size-empty,
modernize-use-using,
'
'
HeaderFilterRegex: 'pybind11/.*h'
HeaderFilterRegex: 'pybind11/.*h'
include/pybind11/chrono.h
View file @
b342c373
...
@@ -33,9 +33,9 @@ PYBIND11_NAMESPACE_BEGIN(detail)
...
@@ -33,9 +33,9 @@ PYBIND11_NAMESPACE_BEGIN(detail)
template
<
typename
type
>
class
duration_caster
{
template
<
typename
type
>
class
duration_caster
{
public
:
public
:
typedef
typename
type
::
rep
rep
;
typedef
typename
type
::
rep
rep
;
typedef
typename
type
::
period
period
;
using
period
=
typename
type
::
period
;
typedef
std
::
chrono
::
duration
<
uint_fast32_t
,
std
::
ratio
<
86400
>>
days
;
using
days
=
std
::
chrono
::
duration
<
uint_fast32_t
,
std
::
ratio
<
86400
>>
;
bool
load
(
handle
src
,
bool
)
{
bool
load
(
handle
src
,
bool
)
{
using
namespace
std
::
chrono
;
using
namespace
std
::
chrono
;
...
@@ -98,7 +98,7 @@ public:
...
@@ -98,7 +98,7 @@ public:
// This is for casting times on the system clock into datetime.datetime instances
// This is for casting times on the system clock into datetime.datetime instances
template
<
typename
Duration
>
class
type_caster
<
std
::
chrono
::
time_point
<
std
::
chrono
::
system_clock
,
Duration
>>
{
template
<
typename
Duration
>
class
type_caster
<
std
::
chrono
::
time_point
<
std
::
chrono
::
system_clock
,
Duration
>>
{
public
:
public
:
typedef
std
::
chrono
::
time_point
<
std
::
chrono
::
system_clock
,
Duration
>
type
;
using
type
=
std
::
chrono
::
time_point
<
std
::
chrono
::
system_clock
,
Duration
>
;
bool
load
(
handle
src
,
bool
)
{
bool
load
(
handle
src
,
bool
)
{
using
namespace
std
::
chrono
;
using
namespace
std
::
chrono
;
...
...
include/pybind11/detail/common.h
View file @
b342c373
...
@@ -537,17 +537,17 @@ template <class T, template<class> class... Predicates> using satisfies_none_of
...
@@ -537,17 +537,17 @@ template <class T, template<class> class... Predicates> using satisfies_none_of
/// Strip the class from a method type
/// Strip the class from a method type
template
<
typename
T
>
struct
remove_class
{
};
template
<
typename
T
>
struct
remove_class
{
};
template
<
typename
C
,
typename
R
,
typename
...
A
>
struct
remove_class
<
R
(
C
::*
)(
A
...)
>
{
typedef
R
type
(
A
...);
};
template
<
typename
C
,
typename
R
,
typename
...
A
>
struct
remove_class
<
R
(
C
::*
)(
A
...)
>
{
using
type
=
R
(
A
...);
};
template
<
typename
C
,
typename
R
,
typename
...
A
>
struct
remove_class
<
R
(
C
::*
)(
A
...)
const
>
{
typedef
R
type
(
A
...);
};
template
<
typename
C
,
typename
R
,
typename
...
A
>
struct
remove_class
<
R
(
C
::*
)(
A
...)
const
>
{
using
type
=
R
(
A
...);
};
/// Helper template to strip away type modifiers
/// Helper template to strip away type modifiers
template
<
typename
T
>
struct
intrinsic_type
{
typedef
T
type
;
};
template
<
typename
T
>
struct
intrinsic_type
{
using
type
=
T
;
};
template
<
typename
T
>
struct
intrinsic_type
<
const
T
>
{
typedef
typename
intrinsic_type
<
T
>::
type
type
;
};
template
<
typename
T
>
struct
intrinsic_type
<
const
T
>
{
using
type
=
typename
intrinsic_type
<
T
>::
type
;
};
template
<
typename
T
>
struct
intrinsic_type
<
T
*>
{
typedef
typename
intrinsic_type
<
T
>::
type
type
;
};
template
<
typename
T
>
struct
intrinsic_type
<
T
*>
{
using
type
=
typename
intrinsic_type
<
T
>::
type
;
};
template
<
typename
T
>
struct
intrinsic_type
<
T
&>
{
typedef
typename
intrinsic_type
<
T
>::
type
type
;
};
template
<
typename
T
>
struct
intrinsic_type
<
T
&>
{
using
type
=
typename
intrinsic_type
<
T
>::
type
;
};
template
<
typename
T
>
struct
intrinsic_type
<
T
&&>
{
typedef
typename
intrinsic_type
<
T
>::
type
type
;
};
template
<
typename
T
>
struct
intrinsic_type
<
T
&&>
{
using
type
=
typename
intrinsic_type
<
T
>::
type
;
};
template
<
typename
T
,
size_t
N
>
struct
intrinsic_type
<
const
T
[
N
]
>
{
typedef
typename
intrinsic_type
<
T
>::
type
type
;
};
template
<
typename
T
,
size_t
N
>
struct
intrinsic_type
<
const
T
[
N
]
>
{
using
type
=
typename
intrinsic_type
<
T
>::
type
;
};
template
<
typename
T
,
size_t
N
>
struct
intrinsic_type
<
T
[
N
]
>
{
typedef
typename
intrinsic_type
<
T
>::
type
type
;
};
template
<
typename
T
,
size_t
N
>
struct
intrinsic_type
<
T
[
N
]
>
{
using
type
=
typename
intrinsic_type
<
T
>::
type
;
};
template
<
typename
T
>
using
intrinsic_t
=
typename
intrinsic_type
<
T
>::
type
;
template
<
typename
T
>
using
intrinsic_t
=
typename
intrinsic_type
<
T
>::
type
;
/// Helper type to replace 'void' in some expressions
/// Helper type to replace 'void' in some expressions
...
...
include/pybind11/numpy.h
View file @
b342c373
...
@@ -281,7 +281,7 @@ template <typename T> struct is_complex : std::false_type { };
...
@@ -281,7 +281,7 @@ template <typename T> struct is_complex : std::false_type { };
template
<
typename
T
>
struct
is_complex
<
std
::
complex
<
T
>>
:
std
::
true_type
{
};
template
<
typename
T
>
struct
is_complex
<
std
::
complex
<
T
>>
:
std
::
true_type
{
};
template
<
typename
T
>
struct
array_info_scalar
{
template
<
typename
T
>
struct
array_info_scalar
{
typedef
T
type
;
using
type
=
T
;
static
constexpr
bool
is_array
=
false
;
static
constexpr
bool
is_array
=
false
;
static
constexpr
bool
is_empty
=
false
;
static
constexpr
bool
is_empty
=
false
;
static
constexpr
auto
extents
=
_
(
""
);
static
constexpr
auto
extents
=
_
(
""
);
...
...
include/pybind11/pybind11.h
View file @
b342c373
...
@@ -1789,7 +1789,7 @@ template <return_value_policy Policy = return_value_policy::reference_internal,
...
@@ -1789,7 +1789,7 @@ template <return_value_policy Policy = return_value_policy::reference_internal,
typename
KeyType
=
decltype
((
*
std
::
declval
<
Iterator
>
()).
first
),
typename
KeyType
=
decltype
((
*
std
::
declval
<
Iterator
>
()).
first
),
typename
...
Extra
>
typename
...
Extra
>
iterator
make_key_iterator
(
Iterator
first
,
Sentinel
last
,
Extra
&&
...
extra
)
{
iterator
make_key_iterator
(
Iterator
first
,
Sentinel
last
,
Extra
&&
...
extra
)
{
typedef
detail
::
iterator_state
<
Iterator
,
Sentinel
,
true
,
Policy
>
state
;
using
state
=
detail
::
iterator_state
<
Iterator
,
Sentinel
,
true
,
Policy
>
;
if
(
!
detail
::
get_type_info
(
typeid
(
state
),
false
))
{
if
(
!
detail
::
get_type_info
(
typeid
(
state
),
false
))
{
class_
<
state
>
(
handle
(),
"iterator"
,
pybind11
::
module_local
())
class_
<
state
>
(
handle
(),
"iterator"
,
pybind11
::
module_local
())
...
...
tests/test_class.cpp
View file @
b342c373
...
@@ -425,14 +425,14 @@ template <int N> class BreaksBase { public:
...
@@ -425,14 +425,14 @@ template <int N> class BreaksBase { public:
};
};
template
<
int
N
>
class
BreaksTramp
:
public
BreaksBase
<
N
>
{};
template
<
int
N
>
class
BreaksTramp
:
public
BreaksBase
<
N
>
{};
// These should all compile just fine:
// These should all compile just fine:
typedef
py
::
class_
<
BreaksBase
<
1
>
,
std
::
unique_ptr
<
BreaksBase
<
1
>>
,
BreaksTramp
<
1
>>
DoesntBreak1
;
using
DoesntBreak1
=
py
::
class_
<
BreaksBase
<
1
>
,
std
::
unique_ptr
<
BreaksBase
<
1
>>
,
BreaksTramp
<
1
>>
;
typedef
py
::
class_
<
BreaksBase
<
2
>
,
BreaksTramp
<
2
>
,
std
::
unique_ptr
<
BreaksBase
<
2
>>>
DoesntBreak2
;
using
DoesntBreak2
=
py
::
class_
<
BreaksBase
<
2
>
,
BreaksTramp
<
2
>
,
std
::
unique_ptr
<
BreaksBase
<
2
>>>
;
typedef
py
::
class_
<
BreaksBase
<
3
>
,
std
::
unique_ptr
<
BreaksBase
<
3
>>>
DoesntBreak3
;
using
DoesntBreak3
=
py
::
class_
<
BreaksBase
<
3
>
,
std
::
unique_ptr
<
BreaksBase
<
3
>>>
;
typedef
py
::
class_
<
BreaksBase
<
4
>
,
BreaksTramp
<
4
>>
DoesntBreak4
;
using
DoesntBreak4
=
py
::
class_
<
BreaksBase
<
4
>
,
BreaksTramp
<
4
>>
;
typedef
py
::
class_
<
BreaksBase
<
5
>>
DoesntBreak5
;
using
DoesntBreak5
=
py
::
class_
<
BreaksBase
<
5
>>
;
typedef
py
::
class_
<
BreaksBase
<
6
>
,
std
::
shared_ptr
<
BreaksBase
<
6
>>
,
BreaksTramp
<
6
>>
DoesntBreak6
;
using
DoesntBreak6
=
py
::
class_
<
BreaksBase
<
6
>
,
std
::
shared_ptr
<
BreaksBase
<
6
>>
,
BreaksTramp
<
6
>>
;
typedef
py
::
class_
<
BreaksBase
<
7
>
,
BreaksTramp
<
7
>
,
std
::
shared_ptr
<
BreaksBase
<
7
>>>
DoesntBreak7
;
using
DoesntBreak7
=
py
::
class_
<
BreaksBase
<
7
>
,
BreaksTramp
<
7
>
,
std
::
shared_ptr
<
BreaksBase
<
7
>>>
;
typedef
py
::
class_
<
BreaksBase
<
8
>
,
std
::
shared_ptr
<
BreaksBase
<
8
>>>
DoesntBreak8
;
using
DoesntBreak8
=
py
::
class_
<
BreaksBase
<
8
>
,
std
::
shared_ptr
<
BreaksBase
<
8
>>>
;
#define CHECK_BASE(N) static_assert(std::is_same<typename DoesntBreak##N::type, BreaksBase<N>>::value, \
#define CHECK_BASE(N) static_assert(std::is_same<typename DoesntBreak##N::type, BreaksBase<N>>::value, \
"DoesntBreak" #N " has wrong type!")
"DoesntBreak" #N " has wrong type!")
CHECK_BASE
(
1
);
CHECK_BASE
(
2
);
CHECK_BASE
(
3
);
CHECK_BASE
(
4
);
CHECK_BASE
(
5
);
CHECK_BASE
(
6
);
CHECK_BASE
(
7
);
CHECK_BASE
(
8
);
CHECK_BASE
(
1
);
CHECK_BASE
(
2
);
CHECK_BASE
(
3
);
CHECK_BASE
(
4
);
CHECK_BASE
(
5
);
CHECK_BASE
(
6
);
CHECK_BASE
(
7
);
CHECK_BASE
(
8
);
...
...
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