- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
template<typename T>
struct method_traits;
template<typename T, typename RetT, typename... Args>
struct method_traits<RetT(T::*)(Args...)> {
using this_type = T;
using ret_type = RetT;
template<size_t ArgIdx>
using arg_type = typename std::tuple_element<ArgIdx, std::tuple<Args...>>::type;
static constexpr size_t args_count = sizeof...(Args);
static constexpr bool is_const = false;
static constexpr bool is_lvalue = false;
static constexpr bool is_rvalue = false;
};
template<typename T, typename RetT, typename... Args>
struct method_traits<RetT(T::*)(Args...) const> : public method_traits<RetT(T::*)(Args...)> {
static constexpr bool is_const = true;
};
template<typename T, typename RetT, typename... Args>
struct method_traits<RetT(T::*)(Args...) &> : public method_traits<RetT(T::*)(Args...)> {
static constexpr bool is_lvalue = true;
};
template<typename T, typename RetT, typename... Args>
struct method_traits<RetT(T::*)(Args...) &&> : public method_traits<RetT(T::*)(Args...)> {
static constexpr bool is_rvalue = true;
};
template<typename T, typename RetT, typename... Args>
struct method_traits<RetT(T::*)(Args...) const &> : public method_traits<RetT(T::*)(Args...)> {
static constexpr bool is_const = true;
static constexpr bool is_lvalue = true;
};
template<typename T, typename RetT, typename... Args>
struct method_traits<RetT(T::*)(Args...) const &&> : public method_traits<RetT(T::*)(Args...)> {
static constexpr bool is_const = true;
static constexpr bool is_rvalue = true;
};
А вдруг в новом стандарте ещё модификаторов в тип завезут? Страшня стало...
PolinaAksenova 07.05.2021 16:32 # 0
MAKAKA 07.05.2021 16:35 # 0
ASD_77 07.05.2021 17:29 # 0
PolinaAksenova 07.05.2021 17:40 # +1
(•ิ_•ิ)?
ASD_77 07.05.2021 17:59 # 0