style: clang-tidy: modernize-use-using
diff --git a/include/pybind11/chrono.h b/include/pybind11/chrono.h
index ac3d34e..cbe9ace 100644
--- a/include/pybind11/chrono.h
+++ b/include/pybind11/chrono.h
@@ -33,9 +33,9 @@
template <typename type> class duration_caster {
public:
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) {
using namespace std::chrono;
@@ -98,7 +98,7 @@
// 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>> {
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) {
using namespace std::chrono;
diff --git a/include/pybind11/detail/common.h b/include/pybind11/detail/common.h
index 7d6530c..68036c7 100644
--- a/include/pybind11/detail/common.h
+++ b/include/pybind11/detail/common.h
@@ -537,17 +537,17 @@
/// Strip the class from a method type
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...) const> { 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> { using type = R (A...); };
/// Helper template to strip away type modifiers
-template <typename T> struct intrinsic_type { typedef T type; };
-template <typename T> struct intrinsic_type<const T> { typedef typename intrinsic_type<T>::type type; };
-template <typename T> struct intrinsic_type<T*> { typedef typename intrinsic_type<T>::type type; };
-template <typename T> struct intrinsic_type<T&> { typedef typename intrinsic_type<T>::type type; };
-template <typename T> struct intrinsic_type<T&&> { typedef typename intrinsic_type<T>::type 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<T[N]> { typedef typename intrinsic_type<T>::type type; };
+template <typename T> struct intrinsic_type { using type = T; };
+template <typename T> struct intrinsic_type<const T> { using type = typename intrinsic_type<T>::type; };
+template <typename T> struct intrinsic_type<T*> { using type = typename intrinsic_type<T>::type; };
+template <typename T> struct intrinsic_type<T&> { using type = typename intrinsic_type<T>::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]> { using type = typename intrinsic_type<T>::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;
/// Helper type to replace 'void' in some expressions
diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h
index c0b38ce..7c3ac12 100644
--- a/include/pybind11/numpy.h
+++ b/include/pybind11/numpy.h
@@ -281,7 +281,7 @@
template <typename T> struct is_complex<std::complex<T>> : std::true_type { };
template <typename T> struct array_info_scalar {
- typedef T type;
+ using type = T;
static constexpr bool is_array = false;
static constexpr bool is_empty = false;
static constexpr auto extents = _("");
diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h
index 9f1736f..c6334fb 100644
--- a/include/pybind11/pybind11.h
+++ b/include/pybind11/pybind11.h
@@ -1789,7 +1789,7 @@
typename KeyType = decltype((*std::declval<Iterator>()).first),
typename... 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)) {
class_<state>(handle(), "iterator", pybind11::module_local())