mirror of
https://github.com/google/googletest.git
synced 2024-12-26 17:41:03 +08:00
gmock: improve SFINAE for actions involving arguments.
Avoid instantiating functions like std::get<index> for an out of range index when doing SFINAE on the invocability of the action itself. PiperOrigin-RevId: 439415110 Change-Id: Ifc20285a6d526c34830870cd1910c2b2b92e1e81
This commit is contained in:
parent
3ffa237f0e
commit
137f67e91f
@ -1077,7 +1077,8 @@ struct ReturnNewAction {
|
||||
|
||||
template <size_t k>
|
||||
struct ReturnArgAction {
|
||||
template <typename... Args>
|
||||
template <typename... Args,
|
||||
typename = typename std::enable_if<(k < sizeof...(Args))>::type>
|
||||
auto operator()(Args&&... args) const -> decltype(std::get<k>(
|
||||
std::forward_as_tuple(std::forward<Args>(args)...))) {
|
||||
return std::get<k>(std::forward_as_tuple(std::forward<Args>(args)...));
|
||||
|
@ -600,7 +600,8 @@ auto InvokeArgument(F f, Args... args) -> decltype(f(args...)) {
|
||||
|
||||
template <std::size_t index, typename... Params>
|
||||
struct InvokeArgumentAction {
|
||||
template <typename... Args>
|
||||
template <typename... Args,
|
||||
typename = typename std::enable_if<(index < sizeof...(Args))>::type>
|
||||
auto operator()(Args&&... args) const -> decltype(internal::InvokeArgument(
|
||||
std::get<index>(std::forward_as_tuple(std::forward<Args>(args)...)),
|
||||
std::declval<const Params&>()...)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user