Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/tvm/ffi/reflection/overload.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ struct TypedOverload : OverloadBase {
template <std::size_t... I>
Ret CallAux(std::index_sequence<I...>, CaptureTuple& tuple) {
/// NOTE: this works for T, const T, const T&, T&& argument types
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
return f_(static_cast<std::tuple_element_t<I, PackedArgs>>(std::move(*std::get<I>(tuple)))...);
Comment on lines +167 to 168
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The argument forwarding logic can be simplified and made more idiomatic by using std::forward. It achieves the same goal of correctly forwarding the value category of the arguments to the wrapped function f_ but is more concise and recognizable as a forwarding pattern.

    // NOLINTNEXTLINE(bugprone-unchecked-optional-access)
    return f_(std::forward<std::tuple_element_t<I, PackedArgs>>(*std::get<I>(tuple))...);

}

Expand Down Expand Up @@ -273,6 +274,7 @@ namespace reflection {
template <typename Class>
class OverloadObjectDef : private ObjectDef<Class> {
public:
/*! \brief The super class */
using Super = ObjectDef<Class>;
/*!
* \brief Constructor
Expand Down