Skip to content

Commit

Permalink
Make InvokerType assignable only if Args... have no reference types,
Browse files Browse the repository at this point in the history
similarly to `MakerType`.

Defaulted assignment is implicitly deleted if the class has no members of
reference types, but this does not extend to `std::tuple` of references, which
is assignable even if it has reference components (and assigns through them),
so classes with members of tuple types are handled explicitly if needed.

PiperOrigin-RevId: 648725458
  • Loading branch information
QrczakMK committed Jul 2, 2024
1 parent 82c4cec commit c6403fd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion riegeli/base/invoker.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "absl/meta/type_traits.h"
#include "absl/utility/utility.h"
#include "riegeli/base/initializer_internal.h"
#include "riegeli/base/type_traits.h"

namespace riegeli {

Expand Down Expand Up @@ -74,7 +75,8 @@ struct ConstResult : ConstResultImpl<void, Function, Args...> {};
// function can also be a member pointer, in which case the first argument is
// the target reference, reference wrapper, or pointer.
template <typename Function, typename... Args>
class InvokerType {
class InvokerType : public ConditionallyAssignable<absl::conjunction<
absl::negation<std::is_reference<Args>>...>::value> {
public:
// The result of calling `InvokerType&&` with no arguments.
using Result = decltype(absl::apply(std::declval<Function&&>(),
Expand Down

0 comments on commit c6403fd

Please sign in to comment.